pcbnew: keep selected zone highlighted when moding
When adding a cutout to a zone, it helps to have the zone highlighted so that you can see when zone you are operating on.
This commit is contained in:
parent
e160eb0677
commit
f4eaf55497
|
@ -1302,6 +1302,7 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
|
||||||
|
|
||||||
bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER*& aZone )
|
bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER*& aZone )
|
||||||
{
|
{
|
||||||
|
bool clearSelection = false;
|
||||||
aZone = nullptr;
|
aZone = nullptr;
|
||||||
|
|
||||||
// not an action that needs a source zone
|
// not an action that needs a source zone
|
||||||
|
@ -1312,17 +1313,23 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER*& aZo
|
||||||
const SELECTION& selection = selTool->GetSelection();
|
const SELECTION& selection = selTool->GetSelection();
|
||||||
|
|
||||||
if( selection.Empty() )
|
if( selection.Empty() )
|
||||||
|
{
|
||||||
|
clearSelection = true;
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
|
||||||
|
}
|
||||||
|
|
||||||
// we want a single zone
|
// we want a single zone
|
||||||
if( selection.Size() != 1 )
|
if( selection.Size() == 1 )
|
||||||
return false;
|
aZone = dyn_cast<ZONE_CONTAINER*>( selection[0] );
|
||||||
|
|
||||||
aZone = dyn_cast<ZONE_CONTAINER*>( selection[0] );
|
|
||||||
|
|
||||||
// expected a zone, but didn't get one
|
// expected a zone, but didn't get one
|
||||||
if( !aZone )
|
if( !aZone )
|
||||||
|
{
|
||||||
|
if( clearSelection )
|
||||||
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1447,10 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
|
||||||
ZONE_CONTAINER* sourceZone = nullptr;
|
ZONE_CONTAINER* sourceZone = nullptr;
|
||||||
|
|
||||||
if( !getSourceZoneForAction( aMode, sourceZone ) )
|
if( !getSourceZoneForAction( aMode, sourceZone ) )
|
||||||
|
{
|
||||||
|
m_frame->SetNoToolSelected();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ZONE_CREATE_HELPER::PARAMS params;
|
ZONE_CREATE_HELPER::PARAMS params;
|
||||||
|
|
||||||
|
@ -1458,13 +1468,12 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
|
||||||
|
|
||||||
auto& controls = *getViewControls();
|
auto& controls = *getViewControls();
|
||||||
|
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
||||||
|
|
||||||
controls.ShowCursor( true );
|
controls.ShowCursor( true );
|
||||||
controls.SetSnapping( true );
|
controls.SetSnapping( true );
|
||||||
|
|
||||||
runPolygonEventLoop( polyGeomMgr );
|
runPolygonEventLoop( polyGeomMgr );
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
m_frame->SetNoToolSelected();
|
m_frame->SetNoToolSelected();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue