mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7520 Undo framework: Improve local disabling of undo framework
This commit is contained in:
@@ -1121,6 +1121,17 @@ void RimWellRftPlot::onLegendDefinitionChanged()
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellRftPlot::useUndoRedoForFieldChanged()
|
||||
{
|
||||
// m_selectedSources use data types that are not compatible with caf
|
||||
// consider rewrite to caf object using ptrfield instead of pdmpointer
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -102,6 +102,7 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
bool useUndoRedoForFieldChanged() override;
|
||||
|
||||
private:
|
||||
std::map<QString, QStringList> findWellSources();
|
||||
|
@@ -102,13 +102,6 @@ void CmdUiCommandSystemImpl::fieldChangedCommand( const std::vector<PdmFieldHand
|
||||
}
|
||||
}
|
||||
|
||||
caf::PdmUiObjectHandle* uiOwnerObjectHandle = uiObj( fieldsToUpdate[0]->ownerObject() );
|
||||
if ( uiOwnerObjectHandle && !uiOwnerObjectHandle->useUndoRedoForFieldChanged() )
|
||||
{
|
||||
// Temporarily disable undo framework as requested by the PdmUiObjectHandle
|
||||
m_disableUndoForFieldChange = true;
|
||||
}
|
||||
|
||||
if ( commands.size() == 1 )
|
||||
{
|
||||
CmdExecCommandManager::instance()->processExecuteCommand( commands[0] );
|
||||
@@ -117,12 +110,6 @@ void CmdUiCommandSystemImpl::fieldChangedCommand( const std::vector<PdmFieldHand
|
||||
{
|
||||
CmdExecCommandManager::instance()->processExecuteCommandsAsMacro( commands );
|
||||
}
|
||||
|
||||
if ( uiOwnerObjectHandle && !uiOwnerObjectHandle->useUndoRedoForFieldChanged() )
|
||||
{
|
||||
// Restore undo feature to normal operation
|
||||
m_disableUndoForFieldChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -104,15 +104,18 @@ void PdmUiCommandSystemProxy::setUiValueToField( PdmUiFieldHandle* uiFieldHandle
|
||||
|
||||
if ( m_commandInterface )
|
||||
{
|
||||
m_commandInterface->fieldChangedCommand( fieldsToUpdate, newUiValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto fieldHandle : fieldsToUpdate )
|
||||
caf::PdmUiObjectHandle* uiOwnerObjectHandle = uiObj( editorField->ownerObject() );
|
||||
if ( uiOwnerObjectHandle && uiOwnerObjectHandle->useUndoRedoForFieldChanged() )
|
||||
{
|
||||
fieldHandle->uiCapability()->setValueFromUiEditor( newUiValue );
|
||||
m_commandInterface->fieldChangedCommand( fieldsToUpdate, newUiValue );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto fieldHandle : fieldsToUpdate )
|
||||
{
|
||||
fieldHandle->uiCapability()->setValueFromUiEditor( newUiValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user