Skip to content

Commit

Permalink
Discard parameter unodable action if previous value is restored
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Oct 18, 2024
1 parent 8d08025 commit 0ee18c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions Source/Processors/GenericProcessor/GenericProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ void GenericProcessor::setParameter (int parameterIndex, float newValue)
if (currentParameter != nullptr)
{
currentParameter->updateValue();
currentParameter->logValueChange();
parameterValueChanged (currentParameter);
}
}
Expand Down
16 changes: 6 additions & 10 deletions Source/Processors/Parameter/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,18 @@ bool Parameter::ChangeValue::perform()
{
Parameter* p = Parameter::parameterMap[key];

if (! p->isEnabled())
if (! p->isEnabled() || p->currentValue == newValue)
return false;

p->newValue = newValue;
p->getOwner()->parameterChangeRequest (p);

p->valueChanged();

p->logValueChange();

return true;
if (p->currentValue == p->previousValue)
return false;
else
return true;
}

bool Parameter::ChangeValue::undo()
Expand All @@ -251,7 +252,7 @@ bool Parameter::ChangeValue::undo()

p->valueChanged();

p->logValueChange();
//p->logValueChange();

return true;
}
Expand Down Expand Up @@ -1338,7 +1339,6 @@ void SelectedStreamParameter::setStreamNames (Array<String> streamNames_)
{
getOwner()->parameterChangeRequest (this);
valueChanged();
logValueChange();
}
}

Expand Down Expand Up @@ -1448,8 +1448,6 @@ bool TimeParameter::ChangeValue::perform()

p->valueChanged();

p->logValueChange();

return true;
}

Expand All @@ -1463,8 +1461,6 @@ bool TimeParameter::ChangeValue::undo()

p->valueChanged();

p->logValueChange();

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Processors/Parameter/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class PLUGIN_API Parameter
void valueChanged();

/** Makes it possible to undo value changes */
class ChangeValue : public UndoableAction
class PLUGIN_API ChangeValue : public UndoableAction
{
public:
/** Constructor */
Expand Down

0 comments on commit 0ee18c9

Please sign in to comment.