EditCommand class
Undoable change of a level being edited.
Derived classes
- class InsertLayerCommand
- Adds a layer or removes one.
- class MoveLayerCommand
- Moves a layer to another position in the list of layers.
- class SetAdditionalPaletteCommand
- Changes the colors of an additional palette of the level, as an undoable step.
- class SetAnimationCommand
- Changes the timing and the frames of an animated tile, the number of animated tiles stays the same.
- class SetChunkCommand
- Changes the payload of a chunk, as an undoable step.
- class SetEventsCommand
- Changes events of the grid.
- class SetLayerPropertiesCommand
- Changes the description or the name of a layer, its size stays the same.
- class SetLayerTextureCommand
- Replaces the texture of its own of a layer, or removes it, see DocumentLayer::
Texture. - class SetLevelPaletteCommand
- Changes the palette of the level, and whether the level uses it.
- class SetLevelPropertiesCommand
- Changes the level flags and properties.
- class SetLevelTilesCommand
- Changes the pixels or the masks of tiles the level stores in itself, see Formats::
ExtraTileSetRecord:: Embedded. - class SetOffGridEventsCommand
- Changes the events placed off the grid, all of them at once.
- class SetTerrainSplinesCommand
- Changes the ground laid along lines and the tiles of its layer as one step.
- class SetTileOverrideCommand
- Changes how the level overrides the pixels and the collision mask of a tile.
- class SetTilesCommand
- Changes tiles of a layer.
- class SnapshotCommand
- Change of parts of a level kept as snapshots before and after it.
Constructors, destructors, conversion operators
- ~EditCommand() defaulted virtual
Public functions
- void Do(LevelDocument& document, DocumentChanges& changes) pure virtual
- Applies the change to the document, again after it was undone.
- void Undo(LevelDocument& document, DocumentChanges& changes) pure virtual
- Reverts the change.
- auto TryMerge(EditCommand& next) -> bool virtual
- Tries to take over a change that follows this one, which was already applied.
- auto CanMerge(EditCommand& next) -> bool virtual
- Returns
trueif TryMerge() would take overnext, without taking it over. - auto GetName() const -> String pure virtual
- Returns the name shown in the history.
-
auto GetMemoryUsage() const -> std::
size_t pure virtual - Returns the memory the command takes.
Function documentation
bool Jazz2:: Editor:: EditCommand:: TryMerge(EditCommand& next) virtual
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:: EditCommand:: CanMerge(EditCommand& next) virtual
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.