Rotate/Mirror: unbreak immediate mode actions

This commit is contained in:
Mike Williams 2023-01-03 16:05:52 -05:00
parent cbe6cd3048
commit 1ba9a6abe3
2 changed files with 4 additions and 31 deletions

View File

@ -415,16 +415,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
};
auto orientCondition =
[]( const SELECTION& aSel )
{
if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) )
return false;
return SELECTION_CONDITIONS::HasTypes( SCH_EDIT_TOOL::RotatableItems )( aSel );
};
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
@ -454,10 +444,10 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( orientCondition ) );
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( orientCondition ) );
mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( orientCondition ) );
mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( orientCondition ) );
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::zoomTool,
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );

View File

@ -684,23 +684,6 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
auto canMirror =
[ this ]( const SELECTION& aSelection )
{
if( !this->IsType( FRAME_FOOTPRINT_EDITOR )
&& SELECTION_CONDITIONS::OnlyTypes( { PCB_PAD_T } )( aSelection ) )
{
return false;
}
return SELECTION_CONDITIONS::HasTypes( EDIT_TOOL::MirrorableItems )( aSelection );
};
mgr->SetConditions( PCB_ACTIONS::rotateCcw, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( PCB_ACTIONS::rotateCw, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( PCB_ACTIONS::mirrorH, ENABLE( canMirror ) );
mgr->SetConditions( PCB_ACTIONS::mirrorV, ENABLE( canMirror ) );
mgr->SetConditions( PCB_ACTIONS::group, ENABLE( SELECTION_CONDITIONS::MoreThan( 1 ) ) );
mgr->SetConditions( PCB_ACTIONS::ungroup, ENABLE( SELECTION_CONDITIONS::HasType( PCB_GROUP_T ) ) );
mgr->SetConditions( PCB_ACTIONS::lock, ENABLE( PCB_SELECTION_CONDITIONS::HasUnlockedItems ) );