Implement SCH_SHEET_PIN selection, rotation and mirroring.
Fixes: lp:1829521 * https://bugs.launchpad.net/kicad/+bug/1829521
This commit is contained in:
parent
5f851a4bad
commit
952108dd43
|
@ -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 )
|
||||
|
|
|
@ -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 ),
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -43,19 +43,6 @@ class NETLIST_OBJECT_LIST;
|
|||
#define MIN_SHEET_HEIGHT 150
|
||||
|
||||
|
||||
/**
|
||||
* Define a sheet pin (label) used in sheets to create hierarchical schematics.
|
||||
*
|
||||
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
|
||||
* pin is used in a component. It connects the objects in the sheet object
|
||||
* to the objects in the schematic page to the objects in the page that is
|
||||
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
|
||||
* connected to a wire, bus, or label. In the schematic page represented by
|
||||
* the sheet, it corresponds to a hierarchical label.
|
||||
*/
|
||||
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
|
||||
|
@ -74,6 +61,19 @@ public:
|
|||
SHEET_UNDEFINED_SIDE
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define a sheet pin (label) used in sheets to create hierarchical schematics.
|
||||
*
|
||||
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
|
||||
* pin is used in a component. It connects the objects in the sheet object
|
||||
* to the objects in the schematic page to the objects in the page that is
|
||||
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
|
||||
* connected to a wire, bus, or label. In the schematic page represented by
|
||||
* the sheet, it corresponds to a hierarchical label.
|
||||
*/
|
||||
class SCH_SHEET_PIN : public SCH_HIERLABEL
|
||||
{
|
||||
private:
|
||||
int m_number; ///< Label number use for saving sheet label to file.
|
||||
///< Sheet label numbering begins at 2.
|
||||
|
|
|
@ -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 <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <sch_draw_panel.h>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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<SCH_COMPONENT*>( 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<SCH_SHEET*>( 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<SCH_COMPONENT*>( 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<SCH_SHEET*>( 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 );
|
||||
|
|
|
@ -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 entryCondition = E_C::MoreThan( 0 ) && E_C::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 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<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||
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<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||
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::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<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||
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,6 +463,8 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( !moving )
|
||||
saveCopyInUndoList( item, UR_CHANGED );
|
||||
|
||||
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
|
@ -505,6 +492,15 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
}
|
||||
|
||||
case SCH_SHEET_PIN_T:
|
||||
{
|
||||
// Rotate pin within parent sheet
|
||||
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
pin->Rotate( sheet->GetBoundingBox().GetCenter() );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BUS_BUS_ENTRY_T:
|
||||
case SCH_BUS_WIRE_ENTRY_T:
|
||||
item->Rotate( item->GetPosition() );
|
||||
|
@ -531,23 +527,20 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
case SCH_BITMAP_T:
|
||||
item->Rotate( item->GetPosition() );
|
||||
|
||||
// The bitmap is cached in Opengl: clear the cache to redraw
|
||||
getView()->RecacheAllItems();
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
// Rotate the sheet on itself. Sheets do not have a anchor point.
|
||||
// Rotate the sheet on itself. Sheets do not have an anchor point.
|
||||
rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
||||
|
||||
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
||||
item->Rotate( rotPoint );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
connections = item->IsConnectable();
|
||||
m_frame->RefreshItem( item );
|
||||
|
@ -563,6 +556,8 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( !moving )
|
||||
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
||||
|
||||
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
||||
{
|
||||
if( item->Type() == SCH_LINE_T )
|
||||
{
|
||||
SCH_LINE* line = (SCH_LINE*) item;
|
||||
|
@ -573,10 +568,26 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
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<SCH_SHEET_PIN*>( item );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
pin->Rotate( sheet->GetBoundingBox().GetCenter() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->Rotate( rotPoint );
|
||||
}
|
||||
}
|
||||
|
||||
connections |= item->IsConnectable();
|
||||
m_frame->RefreshItem( item );
|
||||
|
@ -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<SCH_SHEET_PIN*>( 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( 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<SCH_SHEET_PIN*>( item );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
if( xAxis )
|
||||
pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
|
||||
else
|
||||
pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xAxis )
|
||||
item->MirrorX( mirrorPoint.y );
|
||||
else
|
||||
item->MirrorY( mirrorPoint.x );
|
||||
}
|
||||
|
||||
connections |= item->IsConnectable();
|
||||
m_frame->RefreshItem( item );
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,10 +225,10 @@ 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.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 );
|
||||
|
@ -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<BUS_UNFOLD_MENU> selBusUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue