SetLayerPropertiesCommand class
#include <Jazz2/Editor/Document/Commands.h>
Changes the description or the name of a layer, its size stays the same.
Base classes
- class EditCommand
- Undoable change of a level being edited.
Constructors, destructors, conversion operators
-
SetLayerPropertiesCommand(const LevelDocument& document,
std::
int32_t layer, const Formats:: LayerRecord& record, StringView layerName, String name) - Creates a change from the current state of the layer to the given one.
Public functions
- void Do(LevelDocument& document, DocumentChanges& changes) override
- Applies the change to the document, again after it was undone.
- void Undo(LevelDocument& document, DocumentChanges& changes) override
- Reverts the change.
- auto TryMerge(EditCommand& next) -> bool override
- Tries to take over a change that follows this one, which was already applied.
- auto CanMerge(EditCommand& next) -> bool override
- Returns
trueif TryMerge() would take overnext, without taking it over. - auto GetName() const -> String override
- Returns the name shown in the history.
-
auto GetMemoryUsage() const -> std::
size_t override - Returns the memory the command takes.
- void SetMergesAnyField(bool value)
- Lets a change of other fields of the layer merge into it, if that one lets it too.
Function documentation
bool Jazz2:: Editor:: SetLayerPropertiesCommand:: TryMerge(EditCommand& next) override
Tries to take over a change that follows this one, which was already applied.
Lets a continuous change, such as dragging a slider, be undone in a single step. Returns true if next was taken over, it's then dropped.
bool Jazz2:: Editor:: SetLayerPropertiesCommand:: CanMerge(EditCommand& next) override
Returns true if TryMerge() would take over next, without taking it over.
A transaction is merged only if all of its changes can be, it asks each of them first. A command that merges has to say the same here as its TryMerge() does.
void Jazz2:: Editor:: SetLayerPropertiesCommand:: SetMergesAnyField(bool value)
Lets a change of other fields of the layer merge into it, if that one lets it too.
As moving a layer by its frame changes either of its offsets or both as it's dragged, but is one step. Without it, only a change of the same fields merges, as a value dragged in the properties.