Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::commands::MoveTracksCommand Class Reference

Command for moving tracks to a new position in the tracklist. More...

#include <src/commands/move_tracks_command.h>

Inheritance diagram for zrythm::commands::MoveTracksCommand:
Collaboration diagram for zrythm::commands::MoveTracksCommand:

Public Member Functions

 MoveTracksCommand (structure::tracks::TrackCollection &collection, std::vector< structure::tracks::TrackUuidReference > track_refs, int target_position, std::optional< structure::tracks::Track::Uuid > target_folder=std::nullopt)
 Constructs a new MoveTracksCommand.
void undo () override
void redo () override
int id () const override

Detailed Description

Command for moving tracks to a new position in the tracklist.

Supports moving multiple tracks at once while maintaining their relative order. Folder parent relationships that are internal to the moved set (parent is also being moved) are preserved. External relationships are updated: when target_folder is specified, moved tracks become children of that folder; when nullopt, external folder parents are cleared.

Definition at line 25 of file move_tracks_command.h.

Constructor & Destructor Documentation

◆ MoveTracksCommand()

zrythm::commands::MoveTracksCommand::MoveTracksCommand ( structure::tracks::TrackCollection & collection,
std::vector< structure::tracks::TrackUuidReference > track_refs,
int target_position,
std::optional< structure::tracks::Track::Uuid > target_folder = std::nullopt )

Constructs a new MoveTracksCommand.

Parameters
collectionReference to the TrackCollection.
track_refsReferences to the tracks to move, in their current order.
target_positionThe index in the current (pre-removal) list where the first moved track should end up. For example, if the collection is [A, B, C, D] and tracks [A, B] are moved to between C and D, pass target_position = 3 (the position of D in the current list). The command adjusts internally for the removal of moved tracks.
target_folderThe folder to move tracks into (nullopt = no folder change / clear external folder parents).

The documentation for this class was generated from the following file: