RemoveAlternateEnding::RemoveAlternateEnding(const ScoreLocation &location)
    : QUndoCommand(QObject::tr("Remove Repeat Ending")),
      myLocation(location),
      myOriginalEnding(*ScoreUtils::findByPosition(
                           location.getSystem().getAlternateEndings(),
                           location.getPositionIndex()))
{
}
RemoveDynamic::RemoveDynamic(const ScoreLocation &location)
    : QUndoCommand(QObject::tr("Remove Dynamic")),
      myLocation(location),
      myOriginalDynamic(*ScoreUtils::findByPosition(
                            location.getStaff().getDynamics(),
                            location.getPositionIndex()))
{
    setText(QObject::tr("Remove Dynamic"));
}
AddMultiBarRest::AddMultiBarRest(const ScoreLocation &location, int count)
    : QUndoCommand(QObject::tr("Add Multi-Bar Rest")),
      myLocation(location)
{
    myPosition.setPosition(location.getPositionIndex());
    myPosition.setDurationType(Position::WholeNote);
    myPosition.setRest(true);
    myPosition.setMultiBarRest(count);
}
void Caret::handleSelectionChanged(const ScoreLocation &location)
{
    // Ignore mouse clicks while in playback mode.
    if (myInPlaybackMode)
        return;

    myLocation.setSystemIndex(location.getSystemIndex());
    myLocation.setStaffIndex(location.getStaffIndex());
    myLocation.setPositionIndex(location.getPositionIndex());
    myLocation.setSelectionStart(location.getSelectionStart());
    myLocation.setString(location.getString());

    onLocationChanged();
}