LCOV - code coverage report
Current view: top level - src/engraving/dom - note.h Coverage Total Hit
Test: filtered_coverage.info Lines: 86.4 % 118 102
Test Date: 2026-11-19 04:14:36

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include "containers.h"
      26              : 
      27              : #include "engravingitem.h"
      28              : #include "interval.h"
      29              : #include "noteevent.h"
      30              : #include "noteval.h"
      31              : #include "pitchspelling.h"
      32              : #include "symbol.h"
      33              : #include "tie.h"
      34              : #include "tiejumppointlist.h"
      35              : 
      36              : namespace mu::engraving {
      37              : class Accidental;
      38              : class AccidentalState;
      39              : class Chord;
      40              : class Factory;
      41              : class JianpuOctaveDot;
      42              : class NoteDot;
      43              : class NoteEditData;
      44              : class Score;
      45              : class Spanner;
      46              : class StaffType;
      47              : class Text;
      48              : class Tie;
      49              : class Transaction;
      50              : enum class AccidentalType : unsigned char;
      51              : enum class NoteType : unsigned char;
      52              : struct NoteParenthesisInfo;
      53              : 
      54              : //--------------------------------------------------------------------------------
      55              : // LINE ATTACHMENT POINT
      56              : // Represents the attachment point of any line (tie, slur, glissando...)
      57              : // with respect to the note. Each note can hold a vector of line attach points, which
      58              : // it may use to make spacing decision with the surrounding items.
      59              : //--------------------------------------------------------------------------------
      60              : class LineAttachPoint
      61              : {
      62              : public:
      63        12347 :     LineAttachPoint(EngravingItem* l, double x, double y, bool start)
      64        12347 :         : m_line(l), m_pos(PointF(x, y)), m_start(start) {}
      65              : 
      66       102902 :     const EngravingItem* line() const { return m_line; }
      67        15139 :     const PointF pos() const { return m_pos; }
      68         8782 :     bool start() const { return m_start; }
      69              : 
      70              : private:
      71              :     EngravingItem* m_line = nullptr;
      72              :     PointF m_pos = PointF(0.0, 0.0);
      73              :     bool m_start = true;
      74              : };
      75              : 
      76              : //---------------------------------------------------------
      77              : //   @@ NoteHead
      78              : //---------------------------------------------------------
      79              : 
      80              : class NoteHead final : public Symbol
      81              : {
      82            0 :     OBJECT_ALLOCATOR(engraving, NoteHead)
      83         1429 :     DECLARE_CLASSOF(ElementType::NOTEHEAD)
      84              : 
      85              : public:
      86              :     NoteHead(DummyParentOr<Note> parent);
      87            0 :     NoteHead(const NoteHead&) = default;
      88              :     NoteHead& operator=(const NoteHead&) = delete;
      89            0 :     NoteHead* clone() const override { return new NoteHead(*this); }
      90              :     void setOwnershipParent(DummyParentOr<Note> parent) { EngravingItem::setOwnershipParent(parent); }
      91              : 
      92              :     NoteHeadGroup headGroup() const;
      93              : };
      94              : 
      95              : static const int INVALID_LINE = -10000;
      96              : 
      97              : //---------------------------------------------------------------------------------------
      98              : //   @@ Note
      99              : ///    Graphic representation of a note.
     100              : //
     101              : //   @P accidental       Accidental       note accidental (null if none)
     102              : //   @P accidentalType   int              note accidental type
     103              : //   @P dots             array[NoteDot]   list of note dots (some can be null, read only)
     104              : //   @P dotsCount        int              number of note dots (read only)
     105              : //   @P elements         array[EngravingItem]   list of elements attached to notehead
     106              : //   @P fret             int              fret number in tablature
     107              : //   @P ghost            bool             ghost note (guitar: death note)
     108              : //   @P headScheme       enum (NoteHeadScheme.HEAD_AUTO, .HEAD_NORMAL, .HEAD_PITCHNAME, .HEAD_PITCHNAME_NO_ACCIDENTALS, .HEAD_PITCHNAME_GERMAN, .HEAD_PITCHNAME_GERMAN_NO_ACCIDENTALS, .HEAD_SHAPE_NOTE_4, .HEAD_SHAPE_NOTE_7_AIKIN, .HEAD_SHAPE_NOTE_7_FUNK, .HEAD_SHAPE_NOTE_7_WALKER, .HEAD_SOLFEGE, .HEAD_SOLFEGE_FIXED)
     109              : //   @P headGroup        enum (NoteHeadGroup.HEAD_NORMAL, .HEAD_BREVIS_ALT, .HEAD_CROSS, .HEAD_DIAMOND, .HEAD_DO, .HEAD_FA, .HEAD_LA, .HEAD_MI, .HEAD_RE, .HEAD_SLASH, .HEAD_LARGE_DIAMOND, .HEAD_SOL, .HEAD_TI, .HEAD_XCIRCLE, .HEAD_TRIANGLE)
     110              : //   @P headType         enum (NoteHeadType.HEAD_AUTO, .HEAD_BREVIS, .HEAD_HALF, .HEAD_QUARTER, .HEAD_WHOLE)
     111              : //   @P hidden           bool             hidden, not played note (read only)
     112              : //   @P line             int              notehead position (read only)
     113              : //   @P mirror           bool             mirror notehead on x axis (read only)
     114              : //   @P pitch            int              midi pitch
     115              : //   @P play             bool             play note
     116              : //   @P ppitch           int              actual played midi pitch (honoring ottavas) (read only)
     117              : //   @P isSmall          bool             small notehead
     118              : //   @P string           int              string number in tablature
     119              : //   @P subchannel       int              midi subchannel (for midi articulation) (read only)
     120              : //   @P tieBack          Tie              note backward tie (null if none, read only)
     121              : //   @P tieFor           Tie              note forward tie (null if none, read only)
     122              : //   @P tpc              int              tonal pitch class, as per concert pitch setting
     123              : //   @P tpc1             int              tonal pitch class, non transposed
     124              : //   @P tpc2             int              tonal pitch class, transposed
     125              : //   @P tuning           float            tuning offset in cent
     126              : //   @P userDotPosition  enum (Direction.AUTO, Direction.DOWN, Direction.UP)
     127              : //   @P userMirror       enum (DirectionH.AUTO, DirectionH.LEFT, DirectionH.RIGHT)
     128              : //   @P veloOffset       int
     129              : //   @P veloType         enum (Note.OFFSET_VAL, Note.USER_VAL)
     130              : //---------------------------------------------------------------------------------------
     131              : 
     132              : class Note final : public EngravingItem
     133              : {
     134        83934 :     OBJECT_ALLOCATOR(engraving, Note)
     135         3857 :     DECLARE_CLASSOF(ElementType::NOTE)
     136              : 
     137              : public:
     138              :     enum class SlideType : unsigned char {
     139              :         Undefined = 0,
     140              :         UpToNote,
     141              :         DownToNote,
     142              :         UpFromNote,
     143              :         DownFromNote
     144              :     };
     145              : 
     146              :     enum DisplayFretOption : signed char {
     147              :         Hide = -1,
     148              :         NoHarmonic,
     149              :         NaturalHarmonic,
     150              :         ArtificialHarmonic
     151              :     };
     152              : 
     153              :     ~Note();
     154              : 
     155              :     std::vector<Note*> compoundNotes() const;
     156              : 
     157              :     Note& operator=(const Note&) = delete;
     158          346 :     virtual Note* clone() const override { return new Note(*this, false); }
     159              : 
     160     23163103 :     Chord* chord() const { return (Chord*)ownershipParent(); }
     161              :     void setOwnershipParent(DummyParentOr<Chord> ch);
     162              : 
     163              :     void undoUnlink() override;
     164              : 
     165              :     double mag() const override;
     166              :     EngravingItem* elementBase() const override;
     167              : 
     168              :     void scanElements(std::function<void(EngravingItem*)> func) override;
     169              :     void setTrack(track_idx_t val) override;
     170              : 
     171              :     staff_idx_t vStaffIdx() const override;
     172              : 
     173              :     int playTicks() const;
     174              :     Fraction playTicksFraction() const;
     175              : 
     176              :     double headWidth() const;
     177              :     double headHeight() const;
     178              :     double tabHeadWidth(const StaffType* tab = 0) const;
     179              :     double tabHeadHeight(const StaffType* tab = 0) const;
     180              :     PointF stemDownNW() const;
     181              :     PointF stemUpSE() const;
     182              :     double bboxXShift() const;
     183              :     double noteheadCenterX() const;
     184              :     double bboxRightPos() const;
     185              :     double headBodyWidth() const;
     186              :     double outsideTieAttachX(bool up) const;
     187              : 
     188        52910 :     NoteHeadScheme headScheme() const { return m_headScheme; }
     189              :     void updateHeadGroup(const NoteHeadGroup headGroup);
     190       116271 :     NoteHeadGroup headGroup() const { return m_headGroup; }
     191        38615 :     NoteHeadType headType() const { return m_headType; }
     192              :     void setHeadScheme(NoteHeadScheme val);
     193              :     void setHeadGroup(NoteHeadGroup val);
     194              :     void setHeadType(NoteHeadType t);
     195              : 
     196            0 :     int subtype() const override { return int(m_headGroup); }
     197              :     TranslatableString subtypeUserName() const override;
     198              : 
     199              :     void setPitch(int val, bool notifyAboutChanged = true);
     200              :     void setPitch(int pitch, int tpc1, int tpc2);
     201        97267 :     int pitch() const { return m_pitch; }
     202              : 
     203        30326 :     double centOffset() const { return m_centOffset; }
     204         4825 :     void setCentOffset(double v) { m_centOffset = v; }
     205            0 :     int quarterToneOffset() const { return std::round(m_centOffset / 50); }
     206              : 
     207              :     int ottaveCapoFret() const;
     208              :     int linkedOttavaPitchOffset() const;
     209              :     int ppitch() const;             // playback pitch
     210              :     int epitch() const;             // effective pitch
     211              :     int octave() const;
     212              :     int playingOctave() const;
     213        28901 :     double tuning() const { return m_tuning; }
     214         4941 :     void setTuning(double v) { m_tuning = v; }
     215              :     double playingTuning() const;
     216              :     void undoSetTpc(int v);
     217              :     int transposition() const;
     218      1532326 :     bool fixed() const { return m_fixed; }
     219          164 :     void setFixed(bool v) { m_fixed = v; }
     220        24097 :     int fixedLine() const { return m_fixedLine; }
     221          164 :     void setFixedLine(int v) { m_fixedLine = v; }
     222              : 
     223              :     int tpc() const;
     224        10263 :     int tpc1() const { return m_tpc[0]; }                  // non transposed tpc
     225         6265 :     int tpc2() const { return m_tpc[1]; }                  // transposed tpc
     226              :     String tpcUserName(bool explicitAccidental = false, bool full = false) const;
     227              : 
     228              :     void setTpc(int v);
     229        43472 :     void setTpc1(int v) { m_tpc[0] = v; }
     230        44759 :     void setTpc2(int v) { m_tpc[1] = v; }
     231              :     void setTpcFromPitch(Prefer prefer = Prefer::NEAREST);
     232              :     int tpc1default(int pitch) const;
     233              :     int tpc2default(int pitch) const;
     234              :     int transposeTpc(int tpc) const;
     235              : 
     236              :     int playingTpc() const;
     237              : 
     238       338320 :     Accidental* accidental() const { return m_accidental; }
     239              :     void setAccidental(Accidental* a) { m_accidental = a; }
     240              : 
     241              :     AccidentalType accidentalType() const;
     242              :     void setAccidentalType(AccidentalType type);
     243              : 
     244              :     int line() const;
     245        62582 :     void setLine(int n) { m_line = n; }
     246              : 
     247        43292 :     int fret() const { return m_fret; }
     248         4889 :     void setFret(int val) { m_fret = val; }
     249            0 :     float harmonicFret() const { return m_harmonicFret; }
     250           74 :     void setHarmonicFret(float val) { m_harmonicFret = val; }
     251          503 :     int harmonicPitchOffset() const { return m_harmonicPitchOffset; }
     252           74 :     void setHarmonicPitchOffset(int val) { m_harmonicPitchOffset = val; }
     253        10731 :     DisplayFretOption displayFret() const { return m_displayFret; }
     254           74 :     void setDisplayFret(DisplayFretOption val) { m_displayFret = val; }
     255       373368 :     String fretString() const { return m_fretString; }
     256         1399 :     void setFretString(const String& s) { m_fretString = s; }
     257              :     bool negativeFretUsed() const;
     258        54666 :     int string() const { return m_string; }
     259         4833 :     void setString(int val) { m_string = val; }
     260              :     int stringOrLine() const;
     261              : 
     262       154911 :     bool ghost() const { return m_ghost; }
     263         2210 :     void setGhost(bool val) { m_ghost = val; }
     264       148926 :     bool deadNote() const { return m_deadNote; }
     265         2955 :     void setDeadNote(bool deadNote) { m_deadNote = deadNote; }
     266              : 
     267           12 :     bool fretConflict() const { return m_fretConflict; }
     268         2059 :     void setFretConflict(bool val) { m_fretConflict = val; }
     269              : 
     270            0 :     String jianpuDigit() const { return m_jianpuDigit; }
     271         1764 :     void setJianpuDigit(const String& s) { m_jianpuDigit = s; }
     272            0 :     String jianpuAccidental() const { return m_jianpuAccidental; }
     273         1764 :     void setJianpuAccidental(const String& s) { m_jianpuAccidental = s; }
     274              : 
     275              :     void add(EngravingItem*) override;
     276              :     void remove(EngravingItem*) override;
     277              : 
     278        38619 :     bool isSmall() const { return m_isSmall; }
     279              :     void setSmall(bool val);
     280              : 
     281        28662 :     bool play() const { return m_play; }
     282         5439 :     void setPlay(bool val) { m_play = val; }
     283              : 
     284              :     GuitarBend* bendFor() const;
     285              :     GuitarBend* bendBack() const;
     286              :     GuitarBend* diveFor() const;
     287              :     GuitarBend* diveBack() const;
     288       697405 :     Tie* tieFor() const { return m_tieFor; }
     289       429297 :     Tie* tieBack() const { return m_tieBack; }
     290              :     Tie* tieForNonPartial() const;
     291              :     Tie* tieBackNonPartial() const;
     292              :     LaissezVib* laissezVib() const;
     293              :     PartialTie* incomingPartialTie() const;
     294              :     PartialTie* outgoingPartialTie() const;
     295              :     void setTieFor(Tie* t);
     296              :     void setTieBack(Tie* t);
     297              :     Note* firstTiedNote(bool ignorePlayback = true) const;
     298              :     Note* lastTiedNote(bool ignorePlayback = true) const;
     299              : 
     300              :     int unisonIndex() const;
     301              :     void disconnectTiedNotes();
     302              :     void connectTiedNotes();
     303              : 
     304              :     void setupAfterRead(const Fraction& tick, bool pasteMode);
     305              : 
     306              :     bool acceptDrop(EditData&) const override;
     307              :     EngravingItem* drop(Transaction& tx, EditData&) override;
     308              : 
     309       106293 :     bool hidden() const { return m_hidden; }
     310        62500 :     void setHidden(bool val) { m_hidden = val; }
     311          748 :     bool dotsHidden() const { return m_dotsHidden; }
     312        62541 :     void setDotsHidden(bool val) { m_dotsHidden = val; }
     313              : 
     314              :     NoteType noteType() const;
     315              :     String  noteTypeUserName() const;
     316              : 
     317       263898 :     ElementList& el() { return m_el; }
     318       169419 :     const ElementList& el() const { return m_el; }
     319              : 
     320          972 :     int subchannel() const { return m_subchannel; }
     321        22965 :     void setSubchannel(int val) { m_subchannel = val; }
     322              : 
     323        86259 :     DirectionH userMirror() const { return m_userMirror; }
     324           10 :     void setUserMirror(DirectionH d) { m_userMirror = d; }
     325              : 
     326        86353 :     DirectionV userDotPosition() const { return m_userDotPosition; }
     327           10 :     void setUserDotPosition(DirectionV d) { m_userDotPosition = d; }
     328          706 :     DirectionV dotPosition() const { return m_dotPosition; }
     329        62516 :     void setDotPosition(DirectionV d) { m_dotPosition = d; }
     330              :     bool dotIsUp() const;                 // actual dot position
     331              : 
     332              :     void reset() override;
     333              : 
     334              :     float userVelocityFraction() const;
     335        29843 :     int userVelocity() const { return m_userVelocity; }
     336         1080 :     void setUserVelocity(int v) { m_userVelocity = v; }
     337              : 
     338              :     void setOnTimeOffset(int v);
     339              :     void setOffTimeOffset(int v);
     340              : 
     341              :     int customizeVelocity(int velo) const;
     342            4 :     NoteDot* dot(int n) { return m_dots.at(n); }
     343       155663 :     const std::vector<NoteDot*>& dots() const { return m_dots; }
     344       141581 :     std::vector<NoteDot*>& dots() { return m_dots; }
     345              : 
     346              :     void updateAccidental(AccidentalState*);
     347              :     void updateLine();
     348              :     void setNval(const NoteVal&, Fraction = { -1, 1 });
     349           16 :     NoteEventList& playEvents() { return m_playEvents; }
     350          620 :     const NoteEventList& playEvents() const { return m_playEvents; }
     351              :     NoteEvent* noteEvent(int idx) { return &m_playEvents[idx]; }
     352          455 :     void setPlayEvents(const NoteEventList& l) { m_playEvents = l; }
     353              : 
     354       484483 :     const std::vector<Spanner*>& spannerFor() const { return m_spannerFor; }
     355       521463 :     const std::vector<Spanner*>& spannerBack() const { return m_spannerBack; }
     356              : 
     357          580 :     void addSpannerBack(Spanner* e)
     358              :     {
     359          580 :         if (!muse::contains(m_spannerBack, e)) {
     360          580 :             m_spannerBack.push_back(e);
     361              :         }
     362          580 :     }
     363              : 
     364            0 :     bool removeSpannerBack(Spanner* e) { return muse::remove(m_spannerBack, e); }
     365          580 :     void addSpannerFor(Spanner* e)
     366              :     {
     367          580 :         if (!muse::contains(m_spannerFor, e)) {
     368          580 :             m_spannerFor.push_back(e);
     369              :         }
     370          580 :     }
     371              : 
     372            0 :     bool removeSpannerFor(Spanner* e) { return muse::remove(m_spannerFor, e); }
     373              : 
     374              :     bool transposeDiatonic(int interval, bool keepAlterations, bool useDoubleAccidentals);
     375              :     bool transpose(Interval interval, bool useDoubleSharpsFlats);
     376              : 
     377              :     void localSpatiumChanged(double oldValue, double newValue) override;
     378              :     PropertyValue getProperty(Pid propertyId) const override;
     379              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
     380              :     PropertyValue propertyDefault(Pid) const override;
     381              :     void styleChanged() override;
     382              : 
     383            0 :     bool mark() const { return m_mark; }
     384            0 :     void setMark(bool v) const { m_mark = v; }
     385              :     void setScore(Score* s) override;
     386              : 
     387              :     static SymId noteHead(int direction, NoteHeadGroup, NoteHeadType, int tpc, Key key, NoteHeadScheme scheme);
     388              :     static SymId noteHead(int direction, NoteHeadGroup, NoteHeadType);
     389              :     NoteVal noteVal() const;
     390              : 
     391              :     EngravingItem* nextInEl(EngravingItem* e);
     392              :     EngravingItem* prevInEl(EngravingItem* e);
     393              :     EngravingItem* nextElement() override;
     394              :     EngravingItem* prevElement() override;
     395              :     EngravingItem* lastElementBeforeSegment();
     396              :     EngravingItem* nextSegmentElement() override;
     397              :     EngravingItem* prevSegmentElement() override;
     398              : 
     399              :     String accessibleInfo() const override;
     400              :     String screenReaderInfo() const override;
     401              :     String accessibleExtraInfo() const override;
     402              : 
     403              :     std::vector<Note*> tiedNotes() const;
     404              : 
     405            0 :     void setOffTimeType(int v) { m_offTimeType = v; }
     406            0 :     void setOnTimeType(int v) { m_onTimeType = v; }
     407            0 :     int offTimeType() const { return m_offTimeType; }
     408            0 :     int onTimeType() const { return m_onTimeType; }
     409              : 
     410              :     void attachSlide(SlideType slideType);
     411              : 
     412              :     bool hasSlideToNote() const;
     413              :     bool hasSlideFromNote() const;
     414          492 :     SlideType slideToType() const { return m_slideToType; }
     415            9 :     SlideType slideFromType() const { return m_slideFromType; }
     416              : 
     417              :     void setParenthesesMode(const ParenthesesMode& v, bool addToLinked = true, bool generated = false) override;
     418              : 
     419              :     const NoteParenthesisInfo* parenthesisInfo() const;
     420              : 
     421           78 :     void setHarmonic(bool val) { m_harmonic = val; }
     422       123702 :     bool harmonic() const { return m_harmonic; }
     423              : 
     424              :     bool isGrace() const;
     425              : 
     426              :     bool isPreBendOrDiveStart() const;
     427              :     bool isGraceBendStart() const;
     428              :     bool isContinuationOfBend() const;
     429              : 
     430              :     bool hasAnotherStraightAboveOrBelow(bool above) const;
     431              : 
     432        67678 :     std::vector<LineAttachPoint>& lineAttachPoints() { return m_lineAttachPoints; }
     433       406696 :     const std::vector<LineAttachPoint>& lineAttachPoints() const { return m_lineAttachPoints; }
     434         6103 :     void addStartLineAttachPoint(PointF point, EngravingItem* line) { addLineAttachPoint(point, line, true); }
     435         6244 :     void addEndLineAttachPoint(PointF point, EngravingItem* line) { addLineAttachPoint(point, line, false); }
     436              : 
     437              :     PointF posInStaffCoordinates();
     438              : 
     439       116182 :     bool isTrillCueNote() const { return m_isTrillCueNote; }
     440              :     void setIsTrillCueNote(bool v);
     441              : 
     442              :     SymId noteHead() const;
     443              :     bool isNoteName() const;
     444              : 
     445              :     void updateFrettingForTiesAndBends();
     446              :     bool shouldHideFret() const;
     447              :     bool shouldForceShowFret() const;
     448              : 
     449              :     void setVisible(bool v) override;
     450              : 
     451        23848 :     bool overrideBendVisibilityRules() const { return m_overrideBendVisibilityRules; }
     452           79 :     void setOverrideBendVisibilityRules(bool v) { m_overrideBendVisibilityRules = v; }
     453              : 
     454           95 :     bool hideGeneratedParens() const { return m_hideGeneratedParens; }
     455           55 :     void setHideGeneratedParens(bool v) { m_hideGeneratedParens = v; }
     456              : 
     457        35783 :     TieJumpPointList* tieJumpPoints() { return &m_jumpPoints; }
     458            4 :     const TieJumpPointList* tieJumpPoints() const { return &m_jumpPoints; }
     459              : 
     460              :     bool isExactUnison(Note* other);
     461              : 
     462       128263 :     const std::vector<JianpuOctaveDot*>& jianpuOctaveDots() const { return m_jianpuOctaveDots; }
     463         8708 :     std::vector<JianpuOctaveDot*>& jianpuOctaveDots() { return m_jianpuOctaveDots; }
     464              :     void setJianpuOctaveDotCount(size_t count);
     465              : 
     466              :     struct LayoutData : public EngravingItem::LayoutData {
     467              :         ld_field<bool> useTablature = { "[Note] useTablature", false };
     468              :         ld_field<SymId> cachedNoteheadSym = { "[Note] cachedNoteheadSym", SymId::noSym };    // use in draw to avoid recomputing at every update
     469              :         ld_field<SymId> cachedSymNull = { "[Note] cachedSymNull", SymId::noSym };            // additional symbol for some transparent notehead
     470              :         ld_field<bool> mirror = { "[Note] mirror", false };                                  // True if note is mirrored at stem.
     471              :         ld_field<bool> hasGeneratedParens = { "[Note] hasGeneratedParens", false };          // Should generated parens be created
     472              :     };
     473      1208345 :     DECLARE_LAYOUTDATA_METHODS(Note)
     474              : 
     475              : private:
     476              : 
     477              :     friend class Factory;
     478              :     Note(DummyParentOr<Chord> ch);
     479              :     Note(const Note&, bool link = false);
     480              : 
     481              :     void startDrag(EditData&) override;
     482              :     RectF drag(EditData& ed) override;
     483              :     void endDrag(EditData&) override;
     484              : 
     485              :     void dragInEditMode(EditData& ed);
     486              :     void verticalDrag(EditData& ed);
     487              :     void horizontalDrag(EditData& ed);
     488              : 
     489              :     void addSpanner(Spanner*);
     490              :     void removeSpanner(Spanner*);
     491              :     int concertPitchIdx() const;
     492              :     void updateRelLine(int absLine, bool undoable);
     493              : 
     494              :     static std::vector<Note*> findTiedNotes(Note* startNote, bool followPartialTies = true);
     495              : 
     496              :     void normalizeLeftDragDelta(Segment* seg, EditData& ed, NoteEditData* ned);
     497              : 
     498              :     void getNoteListForDots(std::vector<Note*>& topDownNotes, std::vector<Note*>& bottomUpNotes, std::vector<int>& anchoredDots);
     499              : 
     500              :     void addLineAttachPoint(PointF point, EngravingItem* line, bool start);
     501              : 
     502              :     bool m_ghost = false;        // ghost note
     503              :     bool m_deadNote = false;     // dead note
     504              : 
     505              :     bool m_isTrillCueNote = false;
     506              : 
     507              :     bool m_hidden = false;                 // marks this note as the hidden one if there are
     508              :                                            // overlapping notes; hidden notes are not played
     509              :                                            // and heads + accidentals are not shown
     510              :     bool m_dotsHidden = false;        // dots of hidden notes are hidden too
     511              :                                       // except if only one note is dotted
     512              :     bool m_fretConflict = false;      // used by TAB staves to mark a fretting conflict:
     513              :                                       // two or more notes on the same string
     514              :     bool m_isSmall = false;
     515              :     bool m_play = true;           // note is not played if false
     516              :     mutable bool m_mark = false;  // for use in sequencer
     517              :     bool m_fixed = false;         // for slash notation
     518              : 
     519              :     bool m_overrideBendVisibilityRules = false;
     520              : 
     521              :     bool m_hideGeneratedParens = false;
     522              : 
     523              :     SlideType m_slideToType = SlideType::Undefined;
     524              :     SlideType m_slideFromType = SlideType::Undefined;
     525              : 
     526              :     DirectionH m_userMirror = DirectionH::AUTO;        ///< user override of mirror
     527              :     DirectionV m_userDotPosition = DirectionV::AUTO;   ///< user override of dot position
     528              :     DirectionV m_dotPosition = DirectionV::AUTO;       // used as an intermediate step when resolving dot conflicts
     529              : 
     530              :     NoteHeadScheme m_headScheme = NoteHeadScheme::HEAD_AUTO;
     531              :     NoteHeadGroup m_headGroup = NoteHeadGroup::HEAD_NORMAL;
     532              :     NoteHeadType m_headType = NoteHeadType::HEAD_AUTO;
     533              : 
     534              :     VeloType m_veloType = VeloType::USER_VAL;
     535              : 
     536              :     int m_offTimeType = 0;     // compatibility only 1 - user(absolute), 2 - offset (%)
     537              :     int m_onTimeType = 0;      // compatibility only 1 - user, 2 - offset
     538              : 
     539              :     int m_subchannel = 0;       // articulation
     540              :     int m_line = INVALID_LINE;  // y-Position; 0 - top line.
     541              :     int m_fret = -1;            // for tablature view
     542              :     float m_harmonicFret = -1.0;
     543              :     int m_harmonicPitchOffset = 0;
     544              :     DisplayFretOption m_displayFret = DisplayFretOption::NoHarmonic;
     545              :     int m_string = -1;
     546              :     mutable int m_tpc[2] = { Tpc::TPC_INVALID, Tpc::TPC_INVALID };   // tonal pitch class  (concert/transposing)
     547              :     mutable int m_pitch = 0;      // Note pitch as midi value (0 - 127).
     548              :     mutable double m_centOffset = 0.0; // Pitch offset in cents (100 cents = 1 semitone)
     549              : 
     550              :     int m_userVelocity = 0;     // velocity user offset in percent, or absolute velocity for this note
     551              :     int m_fixedLine = 0;        // fixed line number if _fixed == true
     552              :     double m_tuning = 0.0;      // pitch offset in cent, playable only by internal synthesizer
     553              : 
     554              :     Accidental* m_accidental = nullptr;
     555              : 
     556              :     Tie* m_tieFor = nullptr;
     557              :     Tie* m_tieBack = nullptr;
     558              : 
     559              :     bool m_harmonic = false;
     560              : 
     561              :     bool m_hasParens = false;
     562              : 
     563              :     ElementList m_el;          // fingering, other text, symbols or images
     564              :     std::vector<NoteDot*> m_dots;
     565              :     NoteEventList m_playEvents;
     566              :     std::vector<Spanner*> m_spannerFor;
     567              :     std::vector<Spanner*> m_spannerBack;
     568              : 
     569              :     String m_fretString;
     570              :     String m_jianpuDigit;
     571              :     String m_jianpuAccidental;
     572              :     std::vector<JianpuOctaveDot*> m_jianpuOctaveDots;
     573              : 
     574              :     std::vector<LineAttachPoint> m_lineAttachPoints;
     575              :     TieJumpPointList m_jumpPoints { this };
     576              : };
     577              : } // namespace mu::engraving
        

Generated by: LCOV version 2.0-1