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
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T EE_COLLECTOR::RotatableItems[] = {
|
const KICAD_T EE_COLLECTOR::RotatableItems[] = {
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
|
@ -60,6 +61,7 @@ const KICAD_T EE_COLLECTOR::RotatableItems[] = {
|
||||||
SCH_HIER_LABEL_T,
|
SCH_HIER_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
SCH_BITMAP_T,
|
SCH_BITMAP_T,
|
||||||
SCH_BUS_BUS_ENTRY_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 )
|
SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
|
||||||
{
|
{
|
||||||
if( aItem->Type() == LIB_PIN_T )
|
if( aItem->Type() == LIB_PIN_T )
|
||||||
|
|
|
@ -43,7 +43,6 @@ public:
|
||||||
static const KICAD_T RotatableItems[];
|
static const KICAD_T RotatableItems[];
|
||||||
static const KICAD_T ComponentsOnly[];
|
static const KICAD_T ComponentsOnly[];
|
||||||
static const KICAD_T SheetsOnly[];
|
static const KICAD_T SheetsOnly[];
|
||||||
static const KICAD_T SheetsAndSheetLabels[];
|
|
||||||
|
|
||||||
EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) :
|
EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) :
|
||||||
m_Threshold( 0 ),
|
m_Threshold( 0 ),
|
||||||
|
|
|
@ -1026,21 +1026,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||||
|
|
||||||
switch( parseChar( aReader, line, &line ) )
|
switch( parseChar( aReader, line, &line ) )
|
||||||
{
|
{
|
||||||
case 'R': /* pin on right side */
|
case 'R': sheetPin->SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||||
sheetPin->SetEdge( SCH_SHEET_PIN::SHEET_RIGHT_SIDE );
|
case 'T': sheetPin->SetEdge( SHEET_TOP_SIDE ); break;
|
||||||
break;
|
case 'B': sheetPin->SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||||
|
case 'L': sheetPin->SetEdge( SHEET_LEFT_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;
|
|
||||||
default:
|
default:
|
||||||
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
|
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
|
||||||
}
|
}
|
||||||
|
@ -2124,40 +2113,20 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
||||||
switch( pin.GetEdge() )
|
switch( pin.GetEdge() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case SCH_SHEET_PIN::SHEET_LEFT_SIDE:
|
case SHEET_LEFT_SIDE: side = 'L'; break;
|
||||||
side = 'L';
|
case SHEET_RIGHT_SIDE: side = 'R'; break;
|
||||||
break;
|
case SHEET_TOP_SIDE: side = 'T'; break;
|
||||||
|
case SHEET_BOTTOM_SIDE: side = 'B'; 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pin.GetShape() )
|
switch( pin.GetShape() )
|
||||||
{
|
{
|
||||||
case NET_INPUT:
|
case NET_INPUT: type = 'I'; break;
|
||||||
type = 'I'; break;
|
case NET_OUTPUT: type = 'O'; break;
|
||||||
|
case NET_BIDI: type = 'B'; break;
|
||||||
case NET_OUTPUT:
|
case NET_TRISTATE: type = 'T'; break;
|
||||||
type = 'O'; break;
|
|
||||||
|
|
||||||
case NET_BIDI:
|
|
||||||
type = 'B'; break;
|
|
||||||
|
|
||||||
case NET_TRISTATE:
|
|
||||||
type = 'T'; break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case NET_UNSPECIFIED:
|
case NET_UNSPECIFIED: type = 'U'; break;
|
||||||
type = 'U'; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_out->Print( 0, "F%d %s %c %c %-3d %-3d %-3d\n", pin.GetNumber(),
|
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() )
|
switch( sheetPin.GetEdge() )
|
||||||
{
|
{
|
||||||
case SCH_SHEET_PIN::SHEET_TOP_SIDE: offset_pos.y += width / 2; break;
|
case SHEET_TOP_SIDE: offset_pos.y += width / 2; break;
|
||||||
case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: offset_pos.y -= width / 2; break;
|
case SHEET_BOTTOM_SIDE: offset_pos.y -= width / 2; break;
|
||||||
case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break;
|
case SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break;
|
||||||
case SCH_SHEET_PIN::SHEET_LEFT_SIDE: offset_pos.x += width / 2; break;
|
case SHEET_LEFT_SIDE: offset_pos.x += width / 2; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,9 +267,9 @@ int SCH_SHEET::GetMinWidth() const
|
||||||
int edge = m_pins[i].GetEdge();
|
int edge = m_pins[i].GetEdge();
|
||||||
EDA_RECT pinRect = m_pins[i].GetBoundingBox();
|
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 )
|
if( width < pinRect.GetRight() - m_pos.x )
|
||||||
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();
|
EDA_RECT pinRect = m_pins[i].GetBoundingBox();
|
||||||
|
|
||||||
// Make sure pin is on top or bottom side of sheet.
|
// 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 )
|
if( height < pinRect.GetBottom() - m_pos.y )
|
||||||
height = pinRect.GetBottom() - m_pos.y;
|
height = pinRect.GetBottom() - m_pos.y;
|
||||||
|
|
|
@ -43,6 +43,25 @@ class NETLIST_OBJECT_LIST;
|
||||||
#define MIN_SHEET_HEIGHT 150
|
#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.
|
* 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
|
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:
|
private:
|
||||||
int m_number; ///< Label number use for saving sheet label to file.
|
int m_number; ///< Label number use for saving sheet label to file.
|
||||||
///< Sheet label numbering begins at 2.
|
///< Sheet label numbering begins at 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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
|
* 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 <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <sch_draw_panel.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_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 );
|
SetParent( parent );
|
||||||
wxASSERT( 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();
|
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;
|
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( m_edge == SHEET_LEFT_SIDE || m_edge == SHEET_RIGHT_SIDE )
|
||||||
{
|
{
|
||||||
if( Pos.x > center.x )
|
if( Pos.x > center.x )
|
||||||
{
|
|
||||||
SetEdge( SHEET_RIGHT_SIDE );
|
SetEdge( SHEET_RIGHT_SIDE );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
SetEdge( SHEET_LEFT_SIDE );
|
SetEdge( SHEET_LEFT_SIDE );
|
||||||
}
|
|
||||||
|
|
||||||
SetTextY( Pos.y );
|
SetTextY( Pos.y );
|
||||||
|
|
||||||
|
@ -189,13 +181,9 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( Pos.y > center.y )
|
if( Pos.y > center.y )
|
||||||
{
|
|
||||||
SetEdge( SHEET_BOTTOM_SIDE );
|
SetEdge( SHEET_BOTTOM_SIDE );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
SetEdge( SHEET_TOP_SIDE );
|
SetEdge( SHEET_TOP_SIDE );
|
||||||
}
|
|
||||||
|
|
||||||
SetTextX( Pos.x );
|
SetTextX( Pos.x );
|
||||||
|
|
||||||
|
@ -236,16 +224,9 @@ void SCH_SHEET_PIN::MirrorX( int aXaxis_position )
|
||||||
|
|
||||||
switch( m_edge )
|
switch( m_edge )
|
||||||
{
|
{
|
||||||
case SHEET_TOP_SIDE:
|
case SHEET_TOP_SIDE: SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||||
SetEdge( SHEET_BOTTOM_SIDE );
|
case SHEET_BOTTOM_SIDE: SetEdge( SHEET_TOP_SIDE ); break;
|
||||||
break;
|
default: 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 )
|
switch( m_edge )
|
||||||
{
|
{
|
||||||
case SHEET_LEFT_SIDE:
|
case SHEET_LEFT_SIDE: SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||||
SetEdge( SHEET_RIGHT_SIDE );
|
case SHEET_RIGHT_SIDE: SetEdge( SHEET_LEFT_SIDE ); break;
|
||||||
break;
|
default: 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 )
|
switch( m_edge )
|
||||||
{
|
{
|
||||||
case SHEET_LEFT_SIDE: //pin on left side
|
case SHEET_LEFT_SIDE: SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||||
SetEdge( SHEET_BOTTOM_SIDE );
|
case SHEET_RIGHT_SIDE: SetEdge( SHEET_TOP_SIDE ); break;
|
||||||
break;
|
case SHEET_TOP_SIDE: SetEdge( SHEET_LEFT_SIDE ); break;
|
||||||
|
case SHEET_BOTTOM_SIDE: SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||||
case SHEET_RIGHT_SIDE: //pin on right side
|
default: break;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,11 +490,11 @@ void EE_POINT_EDITOR::updateItem() const
|
||||||
|
|
||||||
switch( pin.GetEdge() )
|
switch( pin.GetEdge() )
|
||||||
{
|
{
|
||||||
case SCH_SHEET_PIN::SHEET_LEFT_SIDE: pos.x = topLeft.x; break;
|
case SHEET_LEFT_SIDE: pos.x = topLeft.x; break;
|
||||||
case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: pos.x = topRight.x; break;
|
case SHEET_RIGHT_SIDE: pos.x = topRight.x; break;
|
||||||
case SCH_SHEET_PIN::SHEET_TOP_SIDE: pos.y = topLeft.y; break;
|
case SHEET_TOP_SIDE: pos.y = topLeft.y; break;
|
||||||
case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: pos.y = botLeft.y; break;
|
case SHEET_BOTTOM_SIDE: pos.y = botLeft.y; break;
|
||||||
case SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE: break;
|
case SHEET_UNDEFINED_SIDE: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pin.SetPosition( pos );
|
pin.SetPosition( pos );
|
||||||
|
|
|
@ -174,6 +174,7 @@ EE_SELECTION_TOOL::~EE_SELECTION_TOOL()
|
||||||
getView()->Remove( &m_selection );
|
getView()->Remove( &m_selection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using E_C = EE_CONDITIONS;
|
||||||
|
|
||||||
bool EE_SELECTION_TOOL::Init()
|
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 };
|
static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
|
||||||
|
|
||||||
auto wireSelection = EE_CONDITIONS::MoreThan( 0 )
|
auto wireSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
|
||||||
&& EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_WIRE_T );
|
auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
|
||||||
auto busSelection = EE_CONDITIONS::MoreThan( 0 )
|
auto wireOrBusSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( wireOrBusTypes );
|
||||||
&& EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T );
|
auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
|
||||||
auto wireOrBusSelection = EE_CONDITIONS::MoreThan( 0 )
|
|
||||||
&& EE_CONDITIONS::OnlyTypes( wireOrBusTypes );
|
|
||||||
auto sheetSelection = SELECTION_CONDITIONS::Count( 1 )
|
|
||||||
&& SELECTION_CONDITIONS::OnlyType( SCH_SHEET_T );
|
|
||||||
auto schEditCondition = [this] ( const SELECTION& aSel ) {
|
auto schEditCondition = [this] ( const SELECTION& aSel ) {
|
||||||
return !m_isLibEdit;
|
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 )
|
void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
|
||||||
{
|
{
|
||||||
|
KICAD_T itemType = aItem->Type();
|
||||||
|
|
||||||
if( aMode == SELECTED )
|
if( aMode == SELECTED )
|
||||||
aItem->SetSelected();
|
aItem->SetSelected();
|
||||||
else if( aMode == BRIGHTENED )
|
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
|
// 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.)
|
// 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();
|
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();
|
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();
|
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() );
|
getView()->Update( aItem->GetParent() );
|
||||||
else
|
else
|
||||||
getView()->Update( aItem );
|
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 )
|
void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
|
||||||
{
|
{
|
||||||
|
KICAD_T itemType = aItem->Type();
|
||||||
|
|
||||||
if( aMode == SELECTED )
|
if( aMode == SELECTED )
|
||||||
aItem->ClearSelected();
|
aItem->ClearSelected();
|
||||||
else if( aMode == BRIGHTENED )
|
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
|
// Unhighlight pins and fields. (All the other component children are currently only
|
||||||
// represented in the LIB_PART.)
|
// 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();
|
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();
|
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();
|
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() );
|
getView()->Update( aItem->GetParent() );
|
||||||
else
|
else
|
||||||
getView()->Update( aItem );
|
getView()->Update( aItem );
|
||||||
|
|
|
@ -245,6 +245,8 @@ SCH_EDIT_TOOL::~SCH_EDIT_TOOL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using E_C = EE_CONDITIONS;
|
||||||
|
|
||||||
bool SCH_EDIT_TOOL::Init()
|
bool SCH_EDIT_TOOL::Init()
|
||||||
{
|
{
|
||||||
EE_TOOL_BASE::Init();
|
EE_TOOL_BASE::Init();
|
||||||
|
@ -289,10 +291,7 @@ bool SCH_EDIT_TOOL::Init()
|
||||||
case SCH_MARKER_T:
|
case SCH_MARKER_T:
|
||||||
case SCH_JUNCTION_T:
|
case SCH_JUNCTION_T:
|
||||||
case SCH_NO_CONNECT_T:
|
case SCH_NO_CONNECT_T:
|
||||||
case SCH_BUS_WIRE_ENTRY_T:
|
|
||||||
case SCH_BUS_BUS_ENTRY_T:
|
|
||||||
case SCH_LINE_T:
|
case SCH_LINE_T:
|
||||||
case SCH_SHEET_PIN_T:
|
|
||||||
case SCH_PIN_T:
|
case SCH_PIN_T:
|
||||||
return false;
|
return false;
|
||||||
default:
|
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 };
|
KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
||||||
auto toLabelCondition = EE_CONDITIONS::Count( 1 )
|
auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
|
||||||
&& EE_CONDITIONS::OnlyTypes( toLabelTypes );
|
|
||||||
|
|
||||||
KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
|
KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
|
||||||
auto toHLabelCondition = EE_CONDITIONS::Count( 1 )
|
auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes);
|
||||||
&& EE_CONDITIONS::OnlyTypes( toHLableTypes);
|
|
||||||
|
|
||||||
KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
||||||
auto toGLabelCondition = EE_CONDITIONS::Count( 1 )
|
auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes);
|
||||||
&& EE_CONDITIONS::OnlyTypes( toGLableTypes);
|
|
||||||
|
|
||||||
KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
|
KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
|
||||||
auto toTextlCondition = EE_CONDITIONS::Count( 1 )
|
auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes);
|
||||||
&& EE_CONDITIONS::OnlyTypes( toTextTypes);
|
|
||||||
|
|
||||||
KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
|
KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
|
||||||
auto entryCondition = EE_CONDITIONS::MoreThan( 0 )
|
auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
|
||||||
&& EE_CONDITIONS::OnlyTypes( entryTypes );
|
|
||||||
|
|
||||||
auto singleComponentCondition = EE_CONDITIONS::Count( 1 )
|
auto singleComponentCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
|
||||||
&& EE_CONDITIONS::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 wireSelectionCondition = EE_CONDITIONS::MoreThan( 0 )
|
auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
|
||||||
&& 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 );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add edit actions to the move tool menu
|
// 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::mirrorX, orientCondition );
|
||||||
moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
|
moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
|
||||||
moveMenu.AddItem( EE_ACTIONS::duplicate, duplicateCondition );
|
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::properties, propertiesCondition );
|
||||||
moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition );
|
moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition );
|
||||||
moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition );
|
moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition );
|
||||||
moveMenu.AddItem( EE_ACTIONS::editFootprint, 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>();
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||||
symUnitMenu->SetTool( this );
|
symUnitMenu->SetTool( this );
|
||||||
m_menu.AddSubMenu( symUnitMenu );
|
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.AddSeparator( E_C::IdleSelection );
|
||||||
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection );
|
moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection );
|
||||||
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::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::editValue, singleComponentCondition, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 );
|
drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::autoplaceFields, 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>();
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||||
symUnitMenu2->SetTool( drawingTools );
|
symUnitMenu2->SetTool( drawingTools );
|
||||||
drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
|
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
|
drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
|
||||||
&& EE_CONDITIONS::Idle, 200 );
|
|
||||||
|
|
||||||
drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && EE_CONDITIONS::Idle, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && EE_CONDITIONS::Idle, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && EE_CONDITIONS::Idle, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && EE_CONDITIONS::Idle, 200 );
|
drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
|
||||||
drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && EE_CONDITIONS::Idle, 250 );
|
drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add editing actions to the selection tool menu
|
// 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::mirrorX, orientCondition, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
|
selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::duplicate, duplicateCondition, 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::properties, propertiesCondition, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::editReference, EE_CONDITIONS::SingleSymbol, 200 );
|
selToolMenu.AddItem( EE_ACTIONS::editReference, E_C::SingleSymbol, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::editValue, EE_CONDITIONS::SingleSymbol, 200 );
|
selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::editFootprint, EE_CONDITIONS::SingleSymbol, 200 );
|
selToolMenu.AddItem( EE_ACTIONS::editFootprint, E_C::SingleSymbol, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 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>();
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
|
||||||
symUnitMenu3->SetTool( m_selectionTool );
|
symUnitMenu3->SetTool( m_selectionTool );
|
||||||
m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
|
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
|
selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
|
||||||
&& EE_CONDITIONS::Idle, 200 );
|
|
||||||
|
|
||||||
selToolMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
selToolMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::toShapeBackslash, 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::toText, toTextlCondition, 200 );
|
||||||
selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
|
selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
|
||||||
|
|
||||||
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 300 );
|
selToolMenu.AddSeparator( E_C::Idle, 300 );
|
||||||
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
|
||||||
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
|
||||||
selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 );
|
selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -478,75 +463,83 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
if( !moving )
|
if( !moving )
|
||||||
saveCopyInUndoList( item, UR_CHANGED );
|
saveCopyInUndoList( item, UR_CHANGED );
|
||||||
|
|
||||||
switch( item->Type() )
|
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
||||||
{
|
{
|
||||||
case SCH_COMPONENT_T:
|
switch( item->Type() )
|
||||||
{
|
|
||||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
|
||||||
|
|
||||||
if( clockwise )
|
|
||||||
component->SetOrientation( CMP_ROTATE_CLOCKWISE );
|
|
||||||
else
|
|
||||||
component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
|
|
||||||
|
|
||||||
if( m_frame->GetAutoplaceFields() )
|
|
||||||
component->AutoAutoplaceFields( m_frame->GetScreen() );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCH_TEXT_T:
|
|
||||||
case SCH_LABEL_T:
|
|
||||||
case SCH_GLOBAL_LABEL_T:
|
|
||||||
case SCH_HIER_LABEL_T:
|
|
||||||
{
|
|
||||||
SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
|
|
||||||
textItem->SetLabelSpinStyle( ( textItem->GetLabelSpinStyle() + 1 ) & 3 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCH_BUS_BUS_ENTRY_T:
|
|
||||||
case SCH_BUS_WIRE_ENTRY_T:
|
|
||||||
item->Rotate( item->GetPosition() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_FIELD_T:
|
|
||||||
{
|
|
||||||
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
|
||||||
|
|
||||||
if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
|
|
||||||
field->SetTextAngle( TEXT_ANGLE_VERT );
|
|
||||||
else
|
|
||||||
field->SetTextAngle( TEXT_ANGLE_HORIZ );
|
|
||||||
|
|
||||||
// Now that we're moving a field, they're no longer autoplaced.
|
|
||||||
if( item->GetParent()->Type() == SCH_COMPONENT_T )
|
|
||||||
{
|
{
|
||||||
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
|
case SCH_COMPONENT_T:
|
||||||
parent->ClearFieldsAutoplaced();
|
{
|
||||||
|
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||||
|
|
||||||
|
if( clockwise )
|
||||||
|
component->SetOrientation( CMP_ROTATE_CLOCKWISE );
|
||||||
|
else
|
||||||
|
component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
|
||||||
|
|
||||||
|
if( m_frame->GetAutoplaceFields() )
|
||||||
|
component->AutoAutoplaceFields( m_frame->GetScreen() );
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
case SCH_TEXT_T:
|
||||||
}
|
case SCH_LABEL_T:
|
||||||
|
case SCH_GLOBAL_LABEL_T:
|
||||||
|
case SCH_HIER_LABEL_T:
|
||||||
|
{
|
||||||
|
SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
|
||||||
|
textItem->SetLabelSpinStyle( ( textItem->GetLabelSpinStyle() + 1 ) & 3 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SCH_BITMAP_T:
|
case SCH_SHEET_PIN_T:
|
||||||
item->Rotate( item->GetPosition() );
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
// The bitmap is cached in Opengl: clear the cache to redraw
|
case SCH_BUS_BUS_ENTRY_T:
|
||||||
getView()->RecacheAllItems();
|
case SCH_BUS_WIRE_ENTRY_T:
|
||||||
break;
|
item->Rotate( item->GetPosition() );
|
||||||
|
break;
|
||||||
|
|
||||||
case SCH_SHEET_T:
|
case SCH_FIELD_T:
|
||||||
// Rotate the sheet on itself. Sheets do not have a anchor point.
|
{
|
||||||
rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
||||||
|
|
||||||
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
|
||||||
|
field->SetTextAngle( TEXT_ANGLE_VERT );
|
||||||
|
else
|
||||||
|
field->SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||||
|
|
||||||
|
// Now that we're moving a field, they're no longer autoplaced.
|
||||||
|
if( item->GetParent()->Type() == SCH_COMPONENT_T )
|
||||||
|
{
|
||||||
|
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
|
||||||
|
parent->ClearFieldsAutoplaced();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 an anchor point.
|
||||||
|
rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
||||||
item->Rotate( rotPoint );
|
item->Rotate( rotPoint );
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connections = item->IsConnectable();
|
connections = item->IsConnectable();
|
||||||
|
@ -563,19 +556,37 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
if( !moving )
|
if( !moving )
|
||||||
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
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 )
|
if( item->GetFlags() & STARTPOINT )
|
||||||
line->RotateStart( rotPoint );
|
line->RotateStart( rotPoint );
|
||||||
|
|
||||||
if( item->GetFlags() & ENDPOINT )
|
if( item->GetFlags() & ENDPOINT )
|
||||||
line->RotateEnd( rotPoint );
|
line->RotateEnd( rotPoint );
|
||||||
}
|
}
|
||||||
else
|
else if( item->Type() == SCH_SHEET_PIN_T )
|
||||||
{
|
{
|
||||||
item->Rotate( rotPoint );
|
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();
|
connections |= item->IsConnectable();
|
||||||
|
@ -650,6 +661,20 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
||||||
break;
|
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_BUS_ENTRY_T:
|
||||||
case SCH_BUS_WIRE_ENTRY_T:
|
case SCH_BUS_WIRE_ENTRY_T:
|
||||||
if( xAxis )
|
if( xAxis )
|
||||||
|
@ -716,10 +741,31 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
||||||
if( !moving )
|
if( !moving )
|
||||||
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
||||||
|
|
||||||
if( xAxis )
|
if( item->Type() == SCH_SHEET_PIN_T )
|
||||||
item->MirrorX( mirrorPoint.y );
|
{
|
||||||
|
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
|
else
|
||||||
item->MirrorY( mirrorPoint.x );
|
{
|
||||||
|
if( xAxis )
|
||||||
|
item->MirrorX( mirrorPoint.y );
|
||||||
|
else
|
||||||
|
item->MirrorY( mirrorPoint.x );
|
||||||
|
}
|
||||||
|
|
||||||
connections |= item->IsConnectable();
|
connections |= item->IsConnectable();
|
||||||
m_frame->RefreshItem( item );
|
m_frame->RefreshItem( item );
|
||||||
|
|
|
@ -243,6 +243,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
appendUndo = true;
|
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.
|
// Apply any initial offset in case we're coming from a previous command.
|
||||||
//
|
//
|
||||||
moveItem( item, m_moveOffset, m_frame->GetToolId() == ID_SCH_DRAG );
|
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:
|
case SCH_SHEET_PIN_T:
|
||||||
{
|
{
|
||||||
SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) aItem;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -198,6 +198,8 @@ SCH_WIRE_BUS_TOOL::~SCH_WIRE_BUS_TOOL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using E_C = EE_CONDITIONS;
|
||||||
|
|
||||||
bool SCH_WIRE_BUS_TOOL::Init()
|
bool SCH_WIRE_BUS_TOOL::Init()
|
||||||
{
|
{
|
||||||
EE_TOOL_BASE::Init();
|
EE_TOOL_BASE::Init();
|
||||||
|
@ -214,8 +216,7 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
||||||
return g_CurrentSheet->Last() != g_RootSheet;
|
return g_CurrentSheet->Last() != g_RootSheet;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto busSelection = EE_CONDITIONS::MoreThan( 0 )
|
auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
|
||||||
&& EE_CONDITIONS::OnlyType( SCH_LINE_LOCATE_BUS_T );
|
|
||||||
|
|
||||||
auto& ctxMenu = m_menu.GetMenu();
|
auto& ctxMenu = m_menu.GetMenu();
|
||||||
|
|
||||||
|
@ -224,13 +225,13 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
||||||
//
|
//
|
||||||
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
|
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
|
||||||
|
|
||||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 10 );
|
ctxMenu.AddSeparator( E_C::ShowAlways, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::startWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::startWire, wireOrBusTool && E_C::Idle, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::startBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::startBus, wireOrBusTool && E_C::Idle, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::startLines, lineTool && EE_CONDITIONS::Idle, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::startLines, lineTool && E_C::Idle, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
|
ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
|
||||||
|
|
||||||
std::shared_ptr<BUS_UNFOLD_MENU> busUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
|
std::shared_ptr<BUS_UNFOLD_MENU> busUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
|
||||||
busUnfoldMenu->SetTool( this );
|
busUnfoldMenu->SetTool( this );
|
||||||
|
@ -238,16 +239,16 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
||||||
ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
|
ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
|
||||||
|
|
||||||
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::addJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::addJunction, wireOrBusTool && E_C::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::addLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::addLabel, wireOrBusTool && E_C::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusTool && E_C::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusTool && E_C::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && E_C::Idle, 100 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
|
ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && E_C::Idle, 100 );
|
||||||
|
|
||||||
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && E_C::Idle, 200 );
|
||||||
ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && E_C::Idle, 200 );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add bus unfolding to the selection tool
|
// 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>();
|
std::shared_ptr<BUS_UNFOLD_MENU> selBusUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
|
||||||
selBusUnfoldMenu->SetTool( m_selectionTool );
|
selBusUnfoldMenu->SetTool( m_selectionTool );
|
||||||
m_selectionTool->GetToolMenu().AddSubMenu( selBusUnfoldMenu );
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -522,13 +523,13 @@ static void computeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint&
|
||||||
int iDy = aSegment->GetEndPoint().y - aSegment->GetStartPoint().y;
|
int iDy = aSegment->GetEndPoint().y - aSegment->GetStartPoint().y;
|
||||||
|
|
||||||
const SCH_SHEET_PIN* connectedPin = getSheetPin( aScreen, aSegment->GetStartPoint() );
|
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
|
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 );
|
aPosition.x += int( aScreen->GetGridSize().x * direction );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue