From 952108dd4359da8f43d36aa4af767ef9c2189a51 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 17 May 2019 17:45:27 +0100 Subject: [PATCH] Implement SCH_SHEET_PIN selection, rotation and mirroring. Fixes: lp:1829521 * https://bugs.launchpad.net/kicad/+bug/1829521 --- eeschema/ee_collectors.cpp | 9 +- eeschema/ee_collectors.h | 1 - eeschema/sch_legacy_plugin.cpp | 57 ++---- eeschema/sch_painter.cpp | 8 +- eeschema/sch_sheet.cpp | 6 +- eeschema/sch_sheet.h | 38 ++-- eeschema/sch_sheet_pin.cpp | 71 ++----- eeschema/tools/ee_point_editor.cpp | 10 +- eeschema/tools/ee_selection_tool.cpp | 29 +-- eeschema/tools/sch_edit_tool.cpp | 284 ++++++++++++++++----------- eeschema/tools/sch_move_tool.cpp | 6 +- eeschema/tools/sch_wire_bus_tool.cpp | 43 ++-- 12 files changed, 269 insertions(+), 293 deletions(-) diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index 6201ca868a..95575fdbaf 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -53,6 +53,7 @@ const KICAD_T EE_COLLECTOR::EditableItems[] = { EOT }; + const KICAD_T EE_COLLECTOR::RotatableItems[] = { SCH_TEXT_T, SCH_LABEL_T, @@ -60,6 +61,7 @@ const KICAD_T EE_COLLECTOR::RotatableItems[] = { SCH_HIER_LABEL_T, SCH_FIELD_T, SCH_COMPONENT_T, + SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, @@ -82,13 +84,6 @@ const KICAD_T EE_COLLECTOR::SheetsOnly[] = { }; -const KICAD_T EE_COLLECTOR::SheetsAndSheetLabels[] = { - SCH_SHEET_PIN_T, - SCH_SHEET_T, - EOT -}; - - SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData ) { if( aItem->Type() == LIB_PIN_T ) diff --git a/eeschema/ee_collectors.h b/eeschema/ee_collectors.h index 31fa1e8fae..13b7d256ab 100644 --- a/eeschema/ee_collectors.h +++ b/eeschema/ee_collectors.h @@ -43,7 +43,6 @@ public: static const KICAD_T RotatableItems[]; static const KICAD_T ComponentsOnly[]; static const KICAD_T SheetsOnly[]; - static const KICAD_T SheetsAndSheetLabels[]; EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) : m_Threshold( 0 ), diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 2ab9956d0b..81ee24a54d 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -1026,21 +1026,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader ) switch( parseChar( aReader, line, &line ) ) { - case 'R': /* pin on right side */ - sheetPin->SetEdge( SCH_SHEET_PIN::SHEET_RIGHT_SIDE ); - break; - - case 'T': /* pin on top side */ - sheetPin->SetEdge( SCH_SHEET_PIN::SHEET_TOP_SIDE ); - break; - - case 'B': /* pin on bottom side */ - sheetPin->SetEdge( SCH_SHEET_PIN::SHEET_BOTTOM_SIDE ); - break; - - case 'L': /* pin on left side */ - sheetPin->SetEdge( SCH_SHEET_PIN::SHEET_LEFT_SIDE ); - break; + case 'R': sheetPin->SetEdge( SHEET_RIGHT_SIDE ); break; + case 'T': sheetPin->SetEdge( SHEET_TOP_SIDE ); break; + case 'B': sheetPin->SetEdge( SHEET_BOTTOM_SIDE ); break; + case 'L': sheetPin->SetEdge( SHEET_LEFT_SIDE ); break; default: SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line ); } @@ -2124,40 +2113,20 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet ) switch( pin.GetEdge() ) { default: - case SCH_SHEET_PIN::SHEET_LEFT_SIDE: - side = 'L'; - break; - - case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: - side = 'R'; - break; - - case SCH_SHEET_PIN::SHEET_TOP_SIDE: - side = 'T'; - break; - - case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: - side = 'B'; - break; + case SHEET_LEFT_SIDE: side = 'L'; break; + case SHEET_RIGHT_SIDE: side = 'R'; break; + case SHEET_TOP_SIDE: side = 'T'; break; + case SHEET_BOTTOM_SIDE: side = 'B'; break; } switch( pin.GetShape() ) { - case NET_INPUT: - type = 'I'; break; - - case NET_OUTPUT: - type = 'O'; break; - - case NET_BIDI: - type = 'B'; break; - - case NET_TRISTATE: - type = 'T'; break; - + case NET_INPUT: type = 'I'; break; + case NET_OUTPUT: type = 'O'; break; + case NET_BIDI: type = 'B'; break; + case NET_TRISTATE: type = 'T'; break; default: - case NET_UNSPECIFIED: - type = 'U'; break; + case NET_UNSPECIFIED: type = 'U'; break; } m_out->Print( 0, "F%d %s %c %c %-3d %-3d %-3d\n", pin.GetNumber(), diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 5b6373bbfa..f93311481e 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1328,10 +1328,10 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer ) switch( sheetPin.GetEdge() ) { - case SCH_SHEET_PIN::SHEET_TOP_SIDE: offset_pos.y += width / 2; break; - case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: offset_pos.y -= width / 2; break; - case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break; - case SCH_SHEET_PIN::SHEET_LEFT_SIDE: offset_pos.x += width / 2; break; + case SHEET_TOP_SIDE: offset_pos.y += width / 2; break; + case SHEET_BOTTOM_SIDE: offset_pos.y -= width / 2; break; + case SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break; + case SHEET_LEFT_SIDE: offset_pos.x += width / 2; break; default: break; } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index c4ea9c52c2..34420f2e5e 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -267,9 +267,9 @@ int SCH_SHEET::GetMinWidth() const int edge = m_pins[i].GetEdge(); EDA_RECT pinRect = m_pins[i].GetBoundingBox(); - wxASSERT( edge != SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE ); + wxASSERT( edge != SHEET_UNDEFINED_SIDE ); - if( edge == SCH_SHEET_PIN::SHEET_TOP_SIDE || edge == SCH_SHEET_PIN::SHEET_BOTTOM_SIDE ) + if( edge == SHEET_TOP_SIDE || edge == SHEET_BOTTOM_SIDE ) { if( width < pinRect.GetRight() - m_pos.x ) width = pinRect.GetRight() - m_pos.x; @@ -308,7 +308,7 @@ int SCH_SHEET::GetMinHeight() const EDA_RECT pinRect = m_pins[i].GetBoundingBox(); // Make sure pin is on top or bottom side of sheet. - if( edge == SCH_SHEET_PIN::SHEET_RIGHT_SIDE || edge == SCH_SHEET_PIN::SHEET_LEFT_SIDE ) + if( edge == SHEET_RIGHT_SIDE || edge == SHEET_LEFT_SIDE ) { if( height < pinRect.GetBottom() - m_pos.y ) height = pinRect.GetBottom() - m_pos.y; diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index a249d768ed..d2b050cb1f 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -43,6 +43,25 @@ class NETLIST_OBJECT_LIST; #define MIN_SHEET_HEIGHT 150 +/** + * Defines the edge of the sheet that the sheet pin is positioned + * SHEET_LEFT_SIDE = 0: pin on left side + * SHEET_RIGHT_SIDE = 1: pin on right side + * SHEET_TOP_SIDE = 2: pin on top side + * SHEET_BOTTOM_SIDE =3: pin on bottom side + * + * For compatibility reasons, this does not follow same values as text orientation. + */ +enum SHEET_SIDE +{ + SHEET_LEFT_SIDE = 0, + SHEET_RIGHT_SIDE, + SHEET_TOP_SIDE, + SHEET_BOTTOM_SIDE, + SHEET_UNDEFINED_SIDE +}; + + /** * Define a sheet pin (label) used in sheets to create hierarchical schematics. * @@ -55,25 +74,6 @@ class NETLIST_OBJECT_LIST; */ class SCH_SHEET_PIN : public SCH_HIERLABEL { -public: - /** - * Defines the edge of the sheet that the sheet pin is positioned - * SHEET_LEFT_SIDE = 0: pin on left side - * SHEET_RIGHT_SIDE = 1: pin on right side - * SHEET_TOP_SIDE = 2: pin on top side - * SHEET_BOTTOM_SIDE =3: pin on bottom side - * - * For compatibility reasons, this does not follow same values as text orientation. - */ - enum SHEET_SIDE - { - SHEET_LEFT_SIDE = 0, - SHEET_RIGHT_SIDE, - SHEET_TOP_SIDE, - SHEET_BOTTOM_SIDE, - SHEET_UNDEFINED_SIDE - }; - private: int m_number; ///< Label number use for saving sheet label to file. ///< Sheet label numbering begins at 2. diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 11051ea598..8c1bafbcb6 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,11 +22,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file sch_sheet_pin.cpp - * @brief Implementation of the SCH_SHEET_PIN class. - */ - #include #include #include @@ -44,7 +39,8 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) : - SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ) + SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ), + m_edge( SHEET_UNDEFINED_SIDE ) { SetParent( parent ); wxASSERT( parent ); @@ -114,7 +110,7 @@ void SCH_SHEET_PIN::SetNumber( int aNumber ) } -void SCH_SHEET_PIN::SetEdge( SCH_SHEET_PIN::SHEET_SIDE aEdge ) +void SCH_SHEET_PIN::SetEdge( SHEET_SIDE aEdge ) { SCH_SHEET* Sheet = GetParent(); @@ -152,7 +148,7 @@ void SCH_SHEET_PIN::SetEdge( SCH_SHEET_PIN::SHEET_SIDE aEdge ) } -enum SCH_SHEET_PIN::SHEET_SIDE SCH_SHEET_PIN::GetEdge() const +enum SHEET_SIDE SCH_SHEET_PIN::GetEdge() const { return m_edge; } @@ -170,13 +166,9 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos ) if( m_edge == SHEET_LEFT_SIDE || m_edge == SHEET_RIGHT_SIDE ) { if( Pos.x > center.x ) - { SetEdge( SHEET_RIGHT_SIDE ); - } else - { SetEdge( SHEET_LEFT_SIDE ); - } SetTextY( Pos.y ); @@ -189,13 +181,9 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos ) else { if( Pos.y > center.y ) - { SetEdge( SHEET_BOTTOM_SIDE ); - } else - { SetEdge( SHEET_TOP_SIDE ); - } SetTextX( Pos.x ); @@ -236,16 +224,9 @@ void SCH_SHEET_PIN::MirrorX( int aXaxis_position ) switch( m_edge ) { - case SHEET_TOP_SIDE: - SetEdge( SHEET_BOTTOM_SIDE ); - break; - - case SHEET_BOTTOM_SIDE: - SetEdge( SHEET_TOP_SIDE ); - break; - - default: - break; + case SHEET_TOP_SIDE: SetEdge( SHEET_BOTTOM_SIDE ); break; + case SHEET_BOTTOM_SIDE: SetEdge( SHEET_TOP_SIDE ); break; + default: break; } } @@ -258,16 +239,9 @@ void SCH_SHEET_PIN::MirrorY( int aYaxis_position ) switch( m_edge ) { - case SHEET_LEFT_SIDE: - SetEdge( SHEET_RIGHT_SIDE ); - break; - - case SHEET_RIGHT_SIDE: - SetEdge( SHEET_LEFT_SIDE ); - break; - - default: - break; + case SHEET_LEFT_SIDE: SetEdge( SHEET_RIGHT_SIDE ); break; + case SHEET_RIGHT_SIDE: SetEdge( SHEET_LEFT_SIDE ); break; + default: break; } } @@ -280,24 +254,11 @@ void SCH_SHEET_PIN::Rotate( wxPoint aPosition ) switch( m_edge ) { - case SHEET_LEFT_SIDE: //pin on left side - SetEdge( SHEET_BOTTOM_SIDE ); - break; - - case SHEET_RIGHT_SIDE: //pin on right side - SetEdge( SHEET_TOP_SIDE ); - break; - - case SHEET_TOP_SIDE: //pin on top side - SetEdge( SHEET_LEFT_SIDE ); - break; - - case SHEET_BOTTOM_SIDE: //pin on bottom side - SetEdge( SHEET_RIGHT_SIDE ); - break; - - default: - break; + case SHEET_LEFT_SIDE: SetEdge( SHEET_BOTTOM_SIDE ); break; + case SHEET_RIGHT_SIDE: SetEdge( SHEET_TOP_SIDE ); break; + case SHEET_TOP_SIDE: SetEdge( SHEET_LEFT_SIDE ); break; + case SHEET_BOTTOM_SIDE: SetEdge( SHEET_RIGHT_SIDE ); break; + default: break; } } diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 817837bb8d..817e1b4b8f 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -490,11 +490,11 @@ void EE_POINT_EDITOR::updateItem() const switch( pin.GetEdge() ) { - case SCH_SHEET_PIN::SHEET_LEFT_SIDE: pos.x = topLeft.x; break; - case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: pos.x = topRight.x; break; - case SCH_SHEET_PIN::SHEET_TOP_SIDE: pos.y = topLeft.y; break; - case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: pos.y = botLeft.y; break; - case SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE: break; + case SHEET_LEFT_SIDE: pos.x = topLeft.x; break; + case SHEET_RIGHT_SIDE: pos.x = topRight.x; break; + case SHEET_TOP_SIDE: pos.y = topLeft.y; break; + case SHEET_BOTTOM_SIDE: pos.y = botLeft.y; break; + case SHEET_UNDEFINED_SIDE: break; } pin.SetPosition( pos ); diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index fd5c8f36dc..68d279f1be 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -174,6 +174,7 @@ EE_SELECTION_TOOL::~EE_SELECTION_TOOL() getView()->Remove( &m_selection ); } +using E_C = EE_CONDITIONS; bool EE_SELECTION_TOOL::Init() { @@ -190,14 +191,10 @@ bool EE_SELECTION_TOOL::Init() static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT }; - auto wireSelection = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_WIRE_T ); - auto busSelection = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T ); - auto wireOrBusSelection = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyTypes( wireOrBusTypes ); - auto sheetSelection = SELECTION_CONDITIONS::Count( 1 ) - && SELECTION_CONDITIONS::OnlyType( SCH_SHEET_T ); + auto wireSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T ); + auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T ); + auto wireOrBusSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( wireOrBusTypes ); + auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T ); auto schEditCondition = [this] ( const SELECTION& aSel ) { return !m_isLibEdit; }; @@ -1061,6 +1058,8 @@ void EE_SELECTION_TOOL::unselect( EDA_ITEM* aItem ) void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup ) { + KICAD_T itemType = aItem->Type(); + if( aMode == SELECTED ) aItem->SetSelected(); else if( aMode == BRIGHTENED ) @@ -1071,7 +1070,7 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup // Highlight pins and fields. (All the other component children are currently only // represented in the LIB_PART and will inherit the settings of the parent component.) - if( aItem->Type() == SCH_COMPONENT_T ) + if( itemType == SCH_COMPONENT_T ) { SCH_PINS& pins = static_cast( aItem )->GetPins(); @@ -1094,7 +1093,7 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup field->SetBrightened(); } } - else if( aItem->Type() == SCH_SHEET_T ) + else if( itemType == SCH_SHEET_T ) { SCH_SHEET_PINS& pins = static_cast( aItem )->GetPins(); @@ -1107,7 +1106,7 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup } } - if( aItem->Type() == SCH_PIN_T || aItem->Type() == SCH_FIELD_T ) + if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T ) getView()->Update( aItem->GetParent() ); else getView()->Update( aItem ); @@ -1116,6 +1115,8 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup ) { + KICAD_T itemType = aItem->Type(); + if( aMode == SELECTED ) aItem->ClearSelected(); else if( aMode == BRIGHTENED ) @@ -1126,7 +1127,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro // Unhighlight pins and fields. (All the other component children are currently only // represented in the LIB_PART.) - if( aItem->Type() == SCH_COMPONENT_T ) + if( itemType == SCH_COMPONENT_T ) { SCH_PINS& pins = static_cast( aItem )->GetPins(); @@ -1149,7 +1150,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro field->ClearBrightened(); } } - else if( aItem->Type() == SCH_SHEET_T ) + else if( itemType == SCH_SHEET_T ) { SCH_SHEET_PINS& pins = static_cast( aItem )->GetPins(); @@ -1162,7 +1163,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro } } - if( aItem->Type() == SCH_PIN_T || aItem->Type() == SCH_FIELD_T ) + if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T ) getView()->Update( aItem->GetParent() ); else getView()->Update( aItem ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index b472d8edf3..b1e5d17344 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -245,6 +245,8 @@ SCH_EDIT_TOOL::~SCH_EDIT_TOOL() } +using E_C = EE_CONDITIONS; + bool SCH_EDIT_TOOL::Init() { EE_TOOL_BASE::Init(); @@ -289,10 +291,7 @@ bool SCH_EDIT_TOOL::Init() case SCH_MARKER_T: case SCH_JUNCTION_T: case SCH_NO_CONNECT_T: - case SCH_BUS_WIRE_ENTRY_T: - case SCH_BUS_BUS_ENTRY_T: case SCH_LINE_T: - case SCH_SHEET_PIN_T: case SCH_PIN_T: return false; default: @@ -321,36 +320,24 @@ bool SCH_EDIT_TOOL::Init() }; KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT }; - auto toLabelCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyTypes( toLabelTypes ); + auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes ); KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT }; - auto toHLabelCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyTypes( toHLableTypes); + auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes); KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT }; - auto toGLabelCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyTypes( toGLableTypes); + auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes); KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT }; - auto toTextlCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyTypes( toTextTypes); + auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes); KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT }; - auto entryCondition = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyTypes( entryTypes ); - - auto singleComponentCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyType( SCH_COMPONENT_T ); - - auto wireSelectionCondition = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_WIRE_T ); + auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes ); - auto busSelectionCondition = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T ); - - auto singleSheetCondition = EE_CONDITIONS::Count( 1 ) - && EE_CONDITIONS::OnlyType( SCH_SHEET_T ); + auto singleComponentCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T ); + auto wireSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T ); + auto busSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T ); + auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T ); // // Add edit actions to the move tool menu @@ -365,22 +352,22 @@ bool SCH_EDIT_TOOL::Init() moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition ); moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition ); moveMenu.AddItem( EE_ACTIONS::duplicate, duplicateCondition ); - moveMenu.AddItem( EE_ACTIONS::doDelete, EE_CONDITIONS::NotEmpty ); + moveMenu.AddItem( EE_ACTIONS::doDelete, E_C::NotEmpty ); moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition ); moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition ); moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition ); moveMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition ); - moveMenu.AddItem( EE_ACTIONS::convertDeMorgan, EE_CONDITIONS::SingleDeMorganSymbol ); + moveMenu.AddItem( EE_ACTIONS::convertDeMorgan, E_C::SingleDeMorganSymbol ); std::shared_ptr symUnitMenu = std::make_shared(); symUnitMenu->SetTool( this ); m_menu.AddSubMenu( symUnitMenu ); - moveMenu.AddMenu( symUnitMenu.get(), EE_CONDITIONS::SingleMultiUnitSymbol, 1 ); + moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 ); - moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection ); - moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection ); - moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection ); + moveMenu.AddSeparator( E_C::IdleSelection ); + moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection ); + moveMenu.AddItem( ACTIONS::copy, E_C::IdleSelection ); } // @@ -398,23 +385,22 @@ bool SCH_EDIT_TOOL::Init() drawMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition, 200 ); drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 ); drawMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 ); - drawMenu.AddItem( EE_ACTIONS::convertDeMorgan, EE_CONDITIONS::SingleDeMorganSymbol, 200 ); + drawMenu.AddItem( EE_ACTIONS::convertDeMorgan, E_C::SingleDeMorganSymbol, 200 ); std::shared_ptr symUnitMenu2 = std::make_shared(); symUnitMenu2->SetTool( drawingTools ); drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 ); - drawMenu.AddMenu( symUnitMenu2.get(), EE_CONDITIONS::SingleMultiUnitSymbol, 1 ); + drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 ); - drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition - && EE_CONDITIONS::Idle, 200 ); + drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 ); - drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 ); - drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 ); - drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && EE_CONDITIONS::Idle, 200 ); - drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && EE_CONDITIONS::Idle, 200 ); - drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && EE_CONDITIONS::Idle, 200 ); - drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && EE_CONDITIONS::Idle, 200 ); - drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && EE_CONDITIONS::Idle, 250 ); + drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 ); + drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 ); + drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 ); + drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 ); + drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 ); + drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 ); + drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 ); // // Add editing actions to the selection tool menu @@ -426,22 +412,21 @@ bool SCH_EDIT_TOOL::Init() selToolMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::duplicate, duplicateCondition, 200 ); - selToolMenu.AddItem( EE_ACTIONS::doDelete, EE_CONDITIONS::NotEmpty, 200 ); + selToolMenu.AddItem( EE_ACTIONS::doDelete, E_C::NotEmpty, 200 ); selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 ); - selToolMenu.AddItem( EE_ACTIONS::editReference, EE_CONDITIONS::SingleSymbol, 200 ); - selToolMenu.AddItem( EE_ACTIONS::editValue, EE_CONDITIONS::SingleSymbol, 200 ); - selToolMenu.AddItem( EE_ACTIONS::editFootprint, EE_CONDITIONS::SingleSymbol, 200 ); + selToolMenu.AddItem( EE_ACTIONS::editReference, E_C::SingleSymbol, 200 ); + selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 ); + selToolMenu.AddItem( EE_ACTIONS::editFootprint, E_C::SingleSymbol, 200 ); selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 ); - selToolMenu.AddItem( EE_ACTIONS::convertDeMorgan, EE_CONDITIONS::SingleSymbol, 200 ); + selToolMenu.AddItem( EE_ACTIONS::convertDeMorgan, E_C::SingleSymbol, 200 ); std::shared_ptr symUnitMenu3 = std::make_shared(); symUnitMenu3->SetTool( m_selectionTool ); m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 ); - selToolMenu.AddMenu( symUnitMenu3.get(), EE_CONDITIONS::SingleMultiUnitSymbol, 1 ); + selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 ); - selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition - && EE_CONDITIONS::Idle, 200 ); + selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 ); selToolMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 ); @@ -451,10 +436,10 @@ bool SCH_EDIT_TOOL::Init() selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 ); - selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 300 ); - selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 ); - selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 ); - selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 ); + selToolMenu.AddSeparator( E_C::Idle, 300 ); + selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 ); + selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 ); + selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 ); return true; } @@ -478,75 +463,83 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( !moving ) saveCopyInUndoList( item, UR_CHANGED ); - switch( item->Type() ) - { - case SCH_COMPONENT_T: + for( int i = 0; clockwise ? i < 1 : i < 3; ++i ) { - SCH_COMPONENT* component = static_cast( item ); - - if( clockwise ) - component->SetOrientation( CMP_ROTATE_CLOCKWISE ); - else - component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); + switch( item->Type() ) + { + case SCH_COMPONENT_T: + { + SCH_COMPONENT* component = static_cast( item ); - if( m_frame->GetAutoplaceFields() ) - component->AutoAutoplaceFields( m_frame->GetScreen() ); + if( clockwise ) + component->SetOrientation( CMP_ROTATE_CLOCKWISE ); + else + component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); - break; - } + if( m_frame->GetAutoplaceFields() ) + component->AutoAutoplaceFields( m_frame->GetScreen() ); - case SCH_TEXT_T: - case SCH_LABEL_T: - case SCH_GLOBAL_LABEL_T: - case SCH_HIER_LABEL_T: - { - SCH_TEXT* textItem = static_cast( item ); - textItem->SetLabelSpinStyle( ( textItem->GetLabelSpinStyle() + 1 ) & 3 ); - break; - } + break; + } - case SCH_BUS_BUS_ENTRY_T: - case SCH_BUS_WIRE_ENTRY_T: - item->Rotate( item->GetPosition() ); - break; + case SCH_TEXT_T: + case SCH_LABEL_T: + case SCH_GLOBAL_LABEL_T: + case SCH_HIER_LABEL_T: + { + SCH_TEXT* textItem = static_cast( item ); + textItem->SetLabelSpinStyle( ( textItem->GetLabelSpinStyle() + 1 ) & 3 ); + break; + } - case SCH_FIELD_T: - { - SCH_FIELD* field = static_cast( item ); + case SCH_SHEET_PIN_T: + { + // Rotate pin within parent sheet + SCH_SHEET_PIN* pin = static_cast( item ); + SCH_SHEET* sheet = pin->GetParent(); + pin->Rotate( sheet->GetBoundingBox().GetCenter() ); + break; + } - if( field->GetTextAngle() == TEXT_ANGLE_HORIZ ) - field->SetTextAngle( TEXT_ANGLE_VERT ); - else - field->SetTextAngle( TEXT_ANGLE_HORIZ ); + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: + item->Rotate( item->GetPosition() ); + break; - // Now that we're moving a field, they're no longer autoplaced. - if( item->GetParent()->Type() == SCH_COMPONENT_T ) + case SCH_FIELD_T: { - SCH_COMPONENT *parent = static_cast( item->GetParent() ); - parent->ClearFieldsAutoplaced(); - } + SCH_FIELD* field = static_cast( item ); - break; - } + if( field->GetTextAngle() == TEXT_ANGLE_HORIZ ) + field->SetTextAngle( TEXT_ANGLE_VERT ); + else + field->SetTextAngle( TEXT_ANGLE_HORIZ ); - case SCH_BITMAP_T: - item->Rotate( item->GetPosition() ); + // Now that we're moving a field, they're no longer autoplaced. + if( item->GetParent()->Type() == SCH_COMPONENT_T ) + { + SCH_COMPONENT *parent = static_cast( item->GetParent() ); + parent->ClearFieldsAutoplaced(); + } - // The bitmap is cached in Opengl: clear the cache to redraw - getView()->RecacheAllItems(); - break; + break; + } - case SCH_SHEET_T: - // Rotate the sheet on itself. Sheets do not have a anchor point. - rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() ); + case SCH_BITMAP_T: + item->Rotate( item->GetPosition() ); + // The bitmap is cached in Opengl: clear the cache to redraw + getView()->RecacheAllItems(); + break; - for( int i = 0; clockwise ? i < 1 : i < 3; ++i ) + case SCH_SHEET_T: + // Rotate the sheet on itself. Sheets do not have an anchor point. + rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() ); item->Rotate( rotPoint ); + break; - break; - - default: - break; + default: + break; + } } connections = item->IsConnectable(); @@ -563,19 +556,37 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( !moving ) saveCopyInUndoList( item, UR_CHANGED, ii > 0 ); - if( item->Type() == SCH_LINE_T ) + for( int i = 0; clockwise ? i < 1 : i < 3; ++i ) { - SCH_LINE* line = (SCH_LINE*) item; + if( item->Type() == SCH_LINE_T ) + { + SCH_LINE* line = (SCH_LINE*) item; - if( item->GetFlags() & STARTPOINT ) - line->RotateStart( rotPoint ); + if( item->GetFlags() & STARTPOINT ) + line->RotateStart( rotPoint ); - if( item->GetFlags() & ENDPOINT ) - line->RotateEnd( rotPoint ); - } - else - { - item->Rotate( rotPoint ); + if( item->GetFlags() & ENDPOINT ) + line->RotateEnd( rotPoint ); + } + else if( item->Type() == SCH_SHEET_PIN_T ) + { + if( item->GetParent()->IsSelected() ) + { + // parent will rotate us + } + else + { + // rotate within parent + SCH_SHEET_PIN* pin = static_cast( item ); + SCH_SHEET* sheet = pin->GetParent(); + + pin->Rotate( sheet->GetBoundingBox().GetCenter() ); + } + } + else + { + item->Rotate( rotPoint ); + } } connections |= item->IsConnectable(); @@ -650,6 +661,20 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) break; } + case SCH_SHEET_PIN_T: + { + // mirror within parent sheet + SCH_SHEET_PIN* pin = static_cast( item ); + SCH_SHEET* sheet = pin->GetParent(); + + if( xAxis ) + pin->MirrorX( sheet->GetBoundingBox().GetCenter().y ); + else + pin->MirrorY( sheet->GetBoundingBox().GetCenter().x ); + + break; + } + case SCH_BUS_BUS_ENTRY_T: case SCH_BUS_WIRE_ENTRY_T: if( xAxis ) @@ -716,10 +741,31 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) if( !moving ) saveCopyInUndoList( item, UR_CHANGED, ii > 0 ); - if( xAxis ) - item->MirrorX( mirrorPoint.y ); + if( item->Type() == SCH_SHEET_PIN_T ) + { + if( item->GetParent()->IsSelected() ) + { + // parent will mirror us + } + else + { + // mirror within parent sheet + SCH_SHEET_PIN* pin = static_cast( item ); + SCH_SHEET* sheet = pin->GetParent(); + + if( xAxis ) + pin->MirrorX( sheet->GetBoundingBox().GetCenter().y ); + else + pin->MirrorY( sheet->GetBoundingBox().GetCenter().x ); + } + } else - item->MirrorY( mirrorPoint.x ); + { + if( xAxis ) + item->MirrorX( mirrorPoint.y ); + else + item->MirrorY( mirrorPoint.x ); + } connections |= item->IsConnectable(); m_frame->RefreshItem( item ); diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 577a8bc22a..1786545559 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -243,6 +243,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) appendUndo = true; } + SCH_ITEM* schItem = (SCH_ITEM*) item; + schItem->SetStoredPos( schItem->GetPosition() ); + // Apply any initial offset in case we're coming from a previous command. // moveItem( item, m_moveOffset, m_frame->GetToolId() == ID_SCH_DRAG ); @@ -599,7 +602,8 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta, bool isDrag ) case SCH_SHEET_PIN_T: { SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) aItem; - pin->ConstrainOnEdge( pin->GetPosition() + (wxPoint) aDelta ); + pin->SetStoredPos( pin->GetStoredPos() + (wxPoint) aDelta ); + pin->ConstrainOnEdge( pin->GetStoredPos() ); break; } default: diff --git a/eeschema/tools/sch_wire_bus_tool.cpp b/eeschema/tools/sch_wire_bus_tool.cpp index ebe23a1953..93b5a93ec4 100644 --- a/eeschema/tools/sch_wire_bus_tool.cpp +++ b/eeschema/tools/sch_wire_bus_tool.cpp @@ -198,6 +198,8 @@ SCH_WIRE_BUS_TOOL::~SCH_WIRE_BUS_TOOL() } +using E_C = EE_CONDITIONS; + bool SCH_WIRE_BUS_TOOL::Init() { EE_TOOL_BASE::Init(); @@ -214,8 +216,7 @@ bool SCH_WIRE_BUS_TOOL::Init() return g_CurrentSheet->Last() != g_RootSheet; }; - auto busSelection = EE_CONDITIONS::MoreThan( 0 ) - && EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T ); + auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T ); auto& ctxMenu = m_menu.GetMenu(); @@ -224,13 +225,13 @@ bool SCH_WIRE_BUS_TOOL::Init() // ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 ); - ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 10 ); - ctxMenu.AddItem( EE_ACTIONS::startWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 ); - ctxMenu.AddItem( EE_ACTIONS::startBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 ); - ctxMenu.AddItem( EE_ACTIONS::startLines, lineTool && EE_CONDITIONS::Idle, 10 ); - ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 ); - ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 ); - ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 ); + ctxMenu.AddSeparator( E_C::ShowAlways, 10 ); + ctxMenu.AddItem( EE_ACTIONS::startWire, wireOrBusTool && E_C::Idle, 10 ); + ctxMenu.AddItem( EE_ACTIONS::startBus, wireOrBusTool && E_C::Idle, 10 ); + ctxMenu.AddItem( EE_ACTIONS::startLines, lineTool && E_C::Idle, 10 ); + ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 ); + ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 ); + ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 ); std::shared_ptr busUnfoldMenu = std::make_shared(); busUnfoldMenu->SetTool( this ); @@ -238,16 +239,16 @@ bool SCH_WIRE_BUS_TOOL::Init() ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 ); ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::addJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::addLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); - ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && EE_CONDITIONS::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::addJunction, wireOrBusTool && E_C::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::addLabel, wireOrBusTool && E_C::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusTool && E_C::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusTool && E_C::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && E_C::Idle, 100 ); + ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 200 ); - ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 ); - ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 ); + ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && E_C::Idle, 200 ); + ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && E_C::Idle, 200 ); // // Add bus unfolding to the selection tool @@ -257,7 +258,7 @@ bool SCH_WIRE_BUS_TOOL::Init() std::shared_ptr selBusUnfoldMenu = std::make_shared(); selBusUnfoldMenu->SetTool( m_selectionTool ); m_selectionTool->GetToolMenu().AddSubMenu( selBusUnfoldMenu ); - selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && EE_CONDITIONS::Idle, 100 ); + selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && E_C::Idle, 100 ); return true; } @@ -522,13 +523,13 @@ static void computeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint& int iDy = aSegment->GetEndPoint().y - aSegment->GetStartPoint().y; const SCH_SHEET_PIN* connectedPin = getSheetPin( aScreen, aSegment->GetStartPoint() ); - auto force = connectedPin ? connectedPin->GetEdge() : SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE; + auto force = connectedPin ? connectedPin->GetEdge() : SHEET_UNDEFINED_SIDE; - if( force == SCH_SHEET_PIN::SHEET_LEFT_SIDE || force == SCH_SHEET_PIN::SHEET_RIGHT_SIDE ) + if( force == SHEET_LEFT_SIDE || force == SHEET_RIGHT_SIDE ) { if( aPosition.x == connectedPin->GetPosition().x ) // push outside sheet boundary { - int direction = ( force == SCH_SHEET_PIN::SHEET_LEFT_SIDE ) ? -1 : 1; + int direction = ( force == SHEET_LEFT_SIDE ) ? -1 : 1; aPosition.x += int( aScreen->GetGridSize().x * direction ); }