MuseScore/libmscore/iname.h
J. Edward Sanchez f363220a1b Fix #297426: The playback cursor is not repositioned when selecting items other than notes, rests or measures
Improved the functionality of the playhead (a.k.a. the playback cursor) so that whenever the user selects an element, the playhead is automatically repositioned to the element's time position. Previously, this worked only for noteheads and rests, but it now works for note stems, beams, augmentation dots, accidentals, ties, slurs, articulations, time signatures, key signatures, clefs, tempo changes, dynamics, lines, barlines, breaks, spacers, measure numbers, text, and so on.

Special cases handled:

* Barlines. The playhead is moved to the start of the measure to the right of the barline, unless it's the last barline in either the entire score or the system, in which case the playhead is moved to the start of the measure to the left of the barline.

* Brackets always have a time position of zero, so the playhead is moved to the start of the first measure in the system that the bracket belongs to.

* Instrument names always have a time position of zero, so the playhead is moved to the start of the first measure in the system that the instrument name belongs to.
2020-04-14 05:15:05 -07:00

60 lines
1.8 KiB
C++

//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __INAME_H__
#define __INAME_H__
#include "text.h"
namespace Ms {
enum class InstrumentNameType : char {
LONG, SHORT
};
class System;
//---------------------------------------------------------
// InstrumentName
//---------------------------------------------------------
class InstrumentName final : public TextBase {
InstrumentNameType _instrumentNameType;
int _layoutPos { 0 };
public:
InstrumentName(Score*);
InstrumentName* clone() const override { return new InstrumentName(*this); }
ElementType type() const override { return ElementType::INSTRUMENT_NAME; }
int layoutPos() const { return _layoutPos; }
void setLayoutPos(int val) { _layoutPos = val; }
QString instrumentNameTypeName() const;
InstrumentNameType instrumentNameType() const { return _instrumentNameType; }
void setInstrumentNameType(InstrumentNameType v);
void setInstrumentNameType(const QString& s);
System* system() const { return toSystem(parent()); }
Fraction playTick() const override;
bool isEditable() const override { return false; }
QVariant getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
QVariant propertyDefault(Pid) const override;
};
} // namespace Ms
#endif