Revert "Use lambdas to fix paste conditions"
This reverts commit 65c7c77c3d
.
This commit is contained in:
parent
3ac5aa5369
commit
1b94534451
|
@ -385,12 +385,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
||||||
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
auto idleCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return SELECTION_CONDITIONS::Idle( aSel );
|
|
||||||
};
|
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||||
|
@ -403,8 +397,8 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( idleCond ) );
|
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( idleCond ) );
|
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
|
||||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
|
||||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
|
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
|
||||||
|
|
|
@ -385,12 +385,6 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
||||||
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
|
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto haveNoToolIdleCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return isEditableCond( aSel ) && SELECTION_CONDITIONS::Idle( aSel );
|
|
||||||
};
|
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::saveAll, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::saveAll, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
|
mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
|
||||||
|
@ -410,7 +404,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( haveNoToolIdleCond ) );
|
mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond && SELECTION_CONDITIONS::Idle ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
|
||||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
|
||||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
|
mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
|
||||||
|
|
|
@ -264,22 +264,6 @@ void PL_EDITOR_FRAME::setupUIConditions()
|
||||||
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
auto idleCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return SELECTION_CONDITIONS::Idle( aSel );
|
|
||||||
};
|
|
||||||
|
|
||||||
auto notEmptyCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return SELECTION_CONDITIONS::NotEmpty( aSel );
|
|
||||||
};
|
|
||||||
|
|
||||||
auto neverCond = [&]( const SELECTION& aSel ) {
|
|
||||||
return SELECTION_CONDITIONS::ShowNever( aSel );
|
|
||||||
};
|
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||||
|
@ -290,10 +274,10 @@ void PL_EDITOR_FRAME::setupUIConditions()
|
||||||
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
||||||
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
|
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( notEmptyCond ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( notEmptyCond ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( idleCond ) );
|
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( notEmptyCond ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||||
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||||
|
@ -305,7 +289,7 @@ void PL_EDITOR_FRAME::setupUIConditions()
|
||||||
mgr->SetConditions( PL_ACTIONS::placeImage, CHECK( cond.CurrentTool( PL_ACTIONS::placeImage ) ) );
|
mgr->SetConditions( PL_ACTIONS::placeImage, CHECK( cond.CurrentTool( PL_ACTIONS::placeImage ) ) );
|
||||||
|
|
||||||
// Not a tool, just a way to activate the action
|
// Not a tool, just a way to activate the action
|
||||||
mgr->SetConditions( PL_ACTIONS::appendImportedWorksheet, CHECK( neverCond ) );
|
mgr->SetConditions( PL_ACTIONS::appendImportedWorksheet, CHECK( SELECTION_CONDITIONS::ShowNever ) );
|
||||||
|
|
||||||
auto titleBlockNormalMode =
|
auto titleBlockNormalMode =
|
||||||
[] ( const SELECTION& )
|
[] ( const SELECTION& )
|
||||||
|
|
|
@ -985,12 +985,6 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
|
||||||
return !GetTargetFPID().GetLibItemName().empty();
|
return !GetTargetFPID().GetLibItemName().empty();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto haveNoToolIdleCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return SELECTION_CONDITIONS::Idle( aSel ) && cond.NoActiveTool();
|
|
||||||
};
|
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
|
mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
|
||||||
mgr->SetConditions( ACTIONS::revert, ENABLE( cond.ContentModified() ) );
|
mgr->SetConditions( ACTIONS::revert, ENABLE( cond.ContentModified() ) );
|
||||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
|
@ -1006,8 +1000,8 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( haveNoToolIdleCond ) );
|
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
|
||||||
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( haveNoToolIdleCond ) );
|
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
||||||
|
|
|
@ -523,12 +523,6 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
||||||
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
auto haveNoToolIdleCond =
|
|
||||||
[&]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return SELECTION_CONDITIONS::Idle( aSel ) && cond.NoActiveTool();
|
|
||||||
};
|
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||||
|
@ -542,8 +536,10 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( haveNoToolIdleCond ) );
|
mgr->SetConditions( ACTIONS::paste,
|
||||||
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( haveNoToolIdleCond ) );
|
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::pasteSpecial,
|
||||||
|
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
|
||||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
||||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
||||||
|
|
Loading…
Reference in New Issue