EventSelection class
#include <Jazz2/Editor/Tools/EventTools.h>
Selected events, of the event grid by their tiles and off the grid by their indices.
Both kinds can be selected together, any number of each. An event off the grid is known by its index in LevelDocument::
Public functions
-
auto GetRevision() const -> std::
uint32_t - Returns a number that changes whenever the selection changes.
- auto IsEmpty() const -> bool
- Returns
trueif nothing is selected, neither on the grid nor off it. - auto HasCells() const -> bool
- Returns
trueif an event of the grid is selected. - auto HasOffGrid() const -> bool
- Returns
trueif an event off the grid is selected. -
auto GetCells() const -> ArrayView<const std::
uint32_t> - Returns the selected tiles of the event grid as.
-
auto GetOffGrid() const -> ArrayView<const std::
int32_t> - Returns the indices of the selected events off the grid, sorted.
-
auto GetCellCount() const -> std::
int32_t - Returns the number of selected events of the grid.
-
auto GetTotalCount() const -> std::
int32_t - Returns the number of all selected events, on the grid and off it.
-
auto Contains(std::
uint32_t cell) const -> bool - Returns
trueif a tile is selected. -
auto ContainsOffGrid(std::
int32_t index) const -> bool - Returns
trueif an event off the grid is selected. - void Clear()
- Clears the selection.
-
void Set(std::
uint32_t cell) - Selects a tile, replacing what was selected.
-
void SetOffGrid(std::
int32_t index) - Selects an event off the grid, replacing what was selected.
-
void Add(std::
uint32_t cell) - Adds a tile to the selection.
-
void AddOffGrid(std::
int32_t index) - Adds an event off the grid to the selection.
-
void Remove(std::
uint32_t cell) - Removes a tile from the selection.
-
void RemoveOffGrid(std::
int32_t index) - Removes an event off the grid from the selection.
-
void Assign(SmallVectorImpl<std::
uint32_t>&& cells) - Replaces the selection by the given tiles, in any order, no event off the grid stays selected.
-
void AssignOffGrid(SmallVectorImpl<std::
int32_t>&& indices) - Replaces the selected events off the grid by the given ones, in any order, the tiles stay selected.
- void DropEmpty(const LevelDocument& document)
- Drops tiles that have no event anymore, as after an undo, and finds the selected events off the grid again.
Function documentation
ArrayView<const std:: uint32_t> Jazz2:: Editor:: EventSelection:: GetCells() const
Returns the selected tiles of the event grid as.
x + y * width, sorted
void Jazz2:: Editor:: EventSelection:: DropEmpty(const LevelDocument& document)
Drops tiles that have no event anymore, as after an undo, and finds the selected events off the grid again.
Called after every change of the events. Events off the grid added or removed since the last call move the indices of the others, the selected ones are found again by what they were then, those that are gone are dropped.