Eeschema: hover start from wire end should copy wire properties
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10128
This commit is contained in:
parent
01f0aad7c0
commit
ecb32b1fb0
|
@ -717,14 +717,14 @@ TOOL_ACTION EE_ACTIONS::addNeededJunctions( "eeschema.InteractiveDrawingLineWire
|
|||
BITMAPS::INVALID_BITMAP, AF_ACTIVATE );
|
||||
|
||||
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawWireActionParam = { LAYER_WIRE, false };
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawWireActionParam = { LAYER_WIRE, false, nullptr };
|
||||
TOOL_ACTION EE_ACTIONS::drawWire( "eeschema.InteractiveDrawingLineWireBus.drawWires",
|
||||
AS_GLOBAL,
|
||||
'W', LEGACY_HK_NAME( "Begin Wire" ),
|
||||
_( "Add Wire" ), _( "Add a wire" ),
|
||||
BITMAPS::add_line, AF_ACTIVATE, (void*) &drawWireActionParam );
|
||||
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawBusActionParam = { LAYER_BUS, false };
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawBusActionParam = { LAYER_BUS, false, nullptr };
|
||||
TOOL_ACTION EE_ACTIONS::drawBus( "eeschema.InteractiveDrawingLineWireBus.drawBuses",
|
||||
AS_GLOBAL,
|
||||
'B', LEGACY_HK_NAME( "Begin Bus" ),
|
||||
|
@ -737,7 +737,7 @@ TOOL_ACTION EE_ACTIONS::unfoldBus( "eeschema.InteractiveDrawingLineWireBus.unfol
|
|||
_( "Unfold from Bus" ), _( "Break a wire out of a bus" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_ACTIVATE );
|
||||
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawLinesActionParam = { LAYER_NOTES, false };
|
||||
const DRAW_SEGMENT_EVENT_PARAMS drawLinesActionParam = { LAYER_NOTES, false, nullptr };
|
||||
TOOL_ACTION EE_ACTIONS::drawLines( "eeschema.InteractiveDrawingLineWireBus.drawLines",
|
||||
AS_GLOBAL,
|
||||
'I', LEGACY_HK_NAME( "Add Graphic PolyLine" ),
|
||||
|
|
|
@ -420,6 +420,10 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
newParams->quitOnDraw = true;
|
||||
newEvt->SetParameter( newParams );
|
||||
|
||||
// Make it so we can copy the parameters of the line we are extending
|
||||
if( collector[0]->Type() == SCH_LINE_T )
|
||||
newParams->sourceSegment = static_cast<SCH_LINE*>( collector[0] );
|
||||
|
||||
getViewControls()->ForceCursorPosition( true, snappedCursorPos );
|
||||
newEvt->SetMousePosition( snappedCursorPos );
|
||||
newEvt->SetHasPosition( true );
|
||||
|
|
|
@ -292,7 +292,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
|||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !aEvent.DisableGridSnapping() );
|
||||
|
||||
VECTOR2D cursorPos = grid.BestSnapAnchor( aEvent.Position(), LAYER_CONNECTABLE, nullptr );
|
||||
startSegments( params->layer, cursorPos );
|
||||
startSegments( params->layer, cursorPos, params->sourceSegment );
|
||||
}
|
||||
|
||||
return doDrawSegments( tool, params->layer, params->quitOnDraw );
|
||||
|
@ -792,36 +792,46 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
|||
}
|
||||
|
||||
|
||||
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos )
|
||||
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos,
|
||||
SCH_LINE* aSegment )
|
||||
{
|
||||
SCH_LINE* segment = nullptr;
|
||||
|
||||
switch ( aType )
|
||||
// If a segment isn't provided to copy properties from, we need to create one
|
||||
if( aSegment == nullptr )
|
||||
{
|
||||
default: segment = new SCH_LINE( aPos, LAYER_NOTES ); break;
|
||||
case LAYER_WIRE: segment = new SCH_LINE( aPos, LAYER_WIRE ); break;
|
||||
case LAYER_BUS: segment = new SCH_LINE( aPos, LAYER_BUS ); break;
|
||||
switch( aType )
|
||||
{
|
||||
default: aSegment = new SCH_LINE( aPos, LAYER_NOTES ); break;
|
||||
case LAYER_WIRE: aSegment = new SCH_LINE( aPos, LAYER_WIRE ); break;
|
||||
case LAYER_BUS: aSegment = new SCH_LINE( aPos, LAYER_BUS ); break;
|
||||
}
|
||||
|
||||
// Give segments a parent so they find the default line/wire/bus widths
|
||||
aSegment->SetParent( &m_frame->Schematic() );
|
||||
}
|
||||
else
|
||||
{
|
||||
aSegment = static_cast<SCH_LINE*>( aSegment->Duplicate() );
|
||||
aSegment->SetStartPoint( (wxPoint) aPos );
|
||||
}
|
||||
|
||||
// Give segments a parent so they find the default line/wire/bus widths
|
||||
segment->SetParent( &m_frame->Schematic() );
|
||||
segment->SetFlags( IS_NEW | IS_MOVING );
|
||||
m_wires.push_back( segment );
|
||||
|
||||
m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
|
||||
aSegment->SetFlags( IS_NEW | IS_MOVING );
|
||||
m_wires.push_back( aSegment );
|
||||
|
||||
m_selectionTool->AddItemToSel( aSegment, true /*quiet mode*/ );
|
||||
|
||||
// We need 2 segments to go from a given start pin to an end point when the
|
||||
// horizontal and vertical lines only switch is on.
|
||||
if( m_frame->eeconfig()->m_Drawing.hv_lines_only )
|
||||
{
|
||||
segment = static_cast<SCH_LINE*>( segment->Duplicate() );
|
||||
segment->SetFlags( IS_NEW | IS_MOVING );
|
||||
m_wires.push_back( segment );
|
||||
aSegment = static_cast<SCH_LINE*>( aSegment->Duplicate() );
|
||||
aSegment->SetFlags( IS_NEW | IS_MOVING );
|
||||
m_wires.push_back( aSegment );
|
||||
|
||||
m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
|
||||
m_selectionTool->AddItemToSel( aSegment, true /*quiet mode*/ );
|
||||
}
|
||||
|
||||
return segment;
|
||||
return aSegment;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ struct DRAW_SEGMENT_EVENT_PARAMS
|
|||
{
|
||||
SCH_LAYER_ID layer;
|
||||
bool quitOnDraw;
|
||||
SCH_LINE* sourceSegment;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -95,7 +96,7 @@ public:
|
|||
|
||||
private:
|
||||
int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw );
|
||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
|
||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos, SCH_LINE* aSegment = nullptr );
|
||||
SCH_LINE* doUnfoldBus( const wxString& aNet, const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
|
||||
void finishSegments();
|
||||
|
||||
|
|
Loading…
Reference in New Issue