GUIDOLib  1.7.7
Guido Engine Internal Documentation
GRSingleNote.h
1 #ifndef GRSingleNote_H
2 #define GRSingleNote_H
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2002 Holger Hoos, Juergen Kilian, Kai Renz
7  Copyright (C) 2002-2017 Grame
8 
9  This Source Code Form is subject to the terms of the Mozilla Public
10  License, v. 2.0. If a copy of the MPL was not distributed with this
11  file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 
13  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
14  research@grame.fr
15 
16 */
17 
18 #include "ARTHead.h"
19 #include "GRNote.h"
20 #include "GRVisitor.h"
21 
22 class GRAccidental;
23 template <class T> class KF_IPointerList;
25 
26 class GRStaff;
27 class GRStdNoteHead;
28 class GRStem;
29 class GRFlag;
30 class GRGlobalStem;
31 class GRBeam;
32 
33 class ARTHead;
34 class ARAccidental;
35 
38 class GRSingleNote : public GRNote
39 {
40 
41  public:
42  GRSingleNote( GRStaff *, const ARNote * ar, const TYPE_TIMEPOSITION& date, const TYPE_DURATION& duration );
43 
44  virtual ~GRSingleNote() {}
45 
46  virtual void accept (GRVisitor& visitor);
47  virtual void addToOffset( const NVPoint & pt);
49 
50  virtual void setHeadState(const ARTHead * headstate);
51  virtual void setNoteFormat(const ARNoteFormat * frmt);
52  virtual int adjustLength(const TYPE_DURATION & ndur);
53  virtual void addArticulation(const ARMusicalTag * mtag);
54 
55  void doCreateNote( const TYPE_DURATION & p_durtemplate /* = DURATION_0*/);
56 
57  virtual void OnDraw( VGDevice & hdc ) const;
58  virtual void GetMap( GuidoElementSelector sel, MapCollector& f, MapInfos& infos ) const;
59 
60  virtual void setSize(float nsize)
61  {
62  mSize = nsize;
63  mStemLen *= mSize;
64  }
65 
66  virtual void updateBoundingBox();
67  virtual void setHPosition( float inX );
68  virtual void setPosition( const NVPoint & inPos );
69  virtual void recalcVerticalPosition();
70 
71  // This is the Position, where Ties and Slurs start
72  // and end (these values includes the note-position)
73  virtual NVPoint getTieStart() const;
74  virtual NVPoint getTieEnd() const;
75  virtual void setFlagOnOff(bool p);
76 
77  // -- Stem related --
78  virtual void setBeamStem(GRBeam * beam, float pos);
79 
80  // This tells the Note, to draw the stem only
81  virtual void drawStemOnly( int flag );
82  virtual void setStemOffsetStartPosition(float inOffset);
83  virtual void setFirstSegmentDrawingState(bool inDrawingState);
84 
85  virtual GDirection getDirection() const { return mStemDir; }
86 
87  // This sets the Direction of the Stem
88  virtual void setStemDirection( GDirection dir );
89 
90  // This sets Stem On or Off (1 == on, 0 == off)
91  virtual void setStemOnOff( bool p );
92 
93  virtual float changeStemLength( float inLen, bool force = false );
94  virtual float setStemLength( float inLen, bool userLength = false );
95  virtual GDirection getStemDirection() const;
96  virtual NVPoint getStemStartPos() const;
97  virtual NVPoint getStemEndPos() const;
98  virtual float getStemLength() const;
99  virtual bool getStemDirSet() const { return mStemDirSet; }
100  virtual bool getStemLengthSet() const { return mStemLengthSet; }
101  virtual bool userLength() const { return fUserLength; }
102  virtual bool isTab() const { return false; }
103 
104  // -
105  virtual const TYPE_DURATION & getDurTemplate() const { return mDurTemplate; }
106  virtual int getNumFaehnchen() const;
107 
108  void removeElements();
109 
110  virtual void tellPosition( GObject * caller, const NVPoint & newPosition );
111  virtual const GRSingleNote* isSingleNote() const { return this; }
112  virtual GRSingleNote* isSingleNote() { return this; }
113 
114  GRStdNoteHead * getNoteHead() const;
115  void extractAccidentals( GRAccidentalList * outList ) const;
116  NVRect getEnclosingBox(bool includeAccidentals=true, bool includeSlurs = true, bool includeTrills=true) const; // gives a position rect that enclose the note, accidentals and articulations
117 
118  ARTHead::HEADSTATE getHeadState() { return mHeadState; }
119 
120  void forceAppearance();
121  const GRStem * getStem() const;
122  float getNoteWidth() const { return mNoteBreite; }
123  void hideHead ();
124 
125 protected:
126  GRStem * getStem();
127  GRFlag * getFlag();
128  const GRFlag *getFlag() const;
129 
131  float mNoteBreite; // the width of a note
132  TYPE_DURATION mDurTemplate; // the template for the display
133 
134 private:
135  void handleAccidental (const ARAccidental* acc);
136  void createNote(const TYPE_DURATION & p_durtemplate /*= DURATION_0*/ );
137  void drawLedges (VGDevice & hdc) const;
138  float getLedgeWidth (VGDevice & hdc) const;
139 
140  GRStdNoteHead * mNoteHead; // exists also in element list.
141  GDirection mStemDir;
142  float mStemLen;
143  bool mStemLengthSet;
144  bool mStemDirSet;
145  bool fUserLength = false;
146 
147  static float fLedgeWidth;
148 
149  ARTHead::HEADSTATE mHeadState;
150 
151  // Used when dispNote param is set on \tuplet-tag to force note appearance
152  NVstring mNoteAppearance;
153 };
154 
155 #endif
GRSingleNote::forceAppearance
void forceAppearance()
GRVisitor
Definition: GRVisitor.h:39
GRSingleNote
Graphical representation of a note event.
Definition: GRSingleNote.h:38
GRSingleNote::mNoteBreite
float mNoteBreite
Definition: GRSingleNote.h:131
GRSingleNote::getDurTemplate
virtual const TYPE_DURATION & getDurTemplate() const
Definition: GRSingleNote.h:105
MapCollector
an abstract class to be provided by clients to collect mappings
Definition: GUIDOScoreMap.h:109
GRSingleNote::accept
virtual void accept(GRVisitor &visitor)
ARTHead
not yet documented
Definition: ARTHead.h:77
ARAccidental
Abstract representation of an accidental element.
Definition: ARAccidental.h:45
GRSingleNote::getStem
const GRStem * getStem() const
duration
GuidoDate duration(CGRHandler inHandleGR)
Returns the music duration of a score.
GObject
The base class for all graphic objects.
Definition: GObject.h:54
GRSingleNote::getNumFaehnchen
virtual int getNumFaehnchen() const
GRSingleNote::removeElements
void removeElements()
GRSingleNote::adjustHeadPosition
virtual ARTHead::HEADSTATE adjustHeadPosition(ARTHead::HEADSTATE sugHeadState=ARTHead::NORMAL)
GRSingleNote::isSingleNote
virtual const GRSingleNote * isSingleNote() const
Definition: GRSingleNote.h:111
GRFlag
Flags attached to a note stem.
Definition: GRFlag.h:27
Fraction
Numerator and denominator.
Definition: Fraction.h:23
GRSingleNote::GetMap
virtual void GetMap(GuidoElementSelector sel, MapCollector &f, MapInfos &infos) const
GRSingleNote::getStemLengthSet
virtual bool getStemLengthSet() const
Definition: GRSingleNote.h:100
GRSingleNote::extractAccidentals
void extractAccidentals(GRAccidentalList *outList) const
GRSingleNote::setStemOnOff
virtual void setStemOnOff(bool p)
ARTHead::NORMAL
Definition: ARTHead.h:80
GRNote
Graphical representation of a note.
Definition: GRNote.h:31
NVPoint
Definition: NVPoint.h:20
GRSingleNote::setStemDirection
virtual void setStemDirection(GDirection dir)
GRSingleNote::doCreateNote
void doCreateNote(const TYPE_DURATION &p_durtemplate)
GRSingleNote::getNoteWidth
float getNoteWidth() const
Definition: GRSingleNote.h:122
MapInfos
A class to propagate device related information.
Definition: GObject.h:42
GRSingleNote::setNoteFormat
virtual void setNoteFormat(const ARNoteFormat *frmt)
GRStaff
A GRStaff represents a single line of music.
Definition: GRStaff.h:181
GRSingleNote::getStemLength
virtual float getStemLength() const
GRSingleNote::getStemEndPos
virtual NVPoint getStemEndPos() const
KF_IPointerList
Definition: ARMusicalVoiceState.h:33
GRSingleNote::mDurTemplate
TYPE_DURATION mDurTemplate
Definition: GRSingleNote.h:132
GRStdNoteHead
Graphical representation of a note head.
Definition: GRStdNoteHead.h:25
GRSingleNote::setBeamStem
virtual void setBeamStem(GRBeam *beam, float pos)
ARNoteFormat
not yet documented
Definition: ARNoteFormat.h:51
GRSingleNote::isTab
virtual bool isTab() const
Definition: GRSingleNote.h:102
GRSingleNote::getTieEnd
virtual NVPoint getTieEnd() const
GRSingleNote::getStemStartPos
virtual NVPoint getStemStartPos() const
GRSingleNote::setHeadState
virtual void setHeadState(const ARTHead *headstate)
GRSingleNote::getTieStart
virtual NVPoint getTieStart() const
GRSingleNote::setPosition
virtual void setPosition(const NVPoint &inPos)
GRSingleNote::mNumHelpLines
int mNumHelpLines
Definition: GRSingleNote.h:130
GRSingleNote::updateBoundingBox
virtual void updateBoundingBox()
GRSingleNote::hideHead
void hideHead()
GRSingleNote::getStemDirection
virtual GDirection getStemDirection() const
VGDevice
Generic platform independant drawing device.
Definition: VGDevice.h:68
GRSingleNote::setFlagOnOff
virtual void setFlagOnOff(bool p)
GRSingleNote::recalcVerticalPosition
virtual void recalcVerticalPosition()
GRSingleNote::tellPosition
virtual void tellPosition(GObject *caller, const NVPoint &newPosition)
GRSingleNote::setFirstSegmentDrawingState
virtual void setFirstSegmentDrawingState(bool inDrawingState)
GRSingleNote::isSingleNote
virtual GRSingleNote * isSingleNote()
Definition: GRSingleNote.h:112
GRAccidental
Accidentals: sharp, flat, natural, double sharp, double flat.
Definition: GRAccidental.h:27
GRSingleNote::GRSingleNote
GRSingleNote(GRStaff *, const ARNote *ar, const TYPE_TIMEPOSITION &date, const TYPE_DURATION &duration)
GRSingleNote::getDirection
virtual GDirection getDirection() const
Definition: GRSingleNote.h:85
GRSingleNote::OnDraw
virtual void OnDraw(VGDevice &hdc) const
GRSingleNote::setSize
virtual void setSize(float nsize)
Definition: GRSingleNote.h:60
ARMusicalTag
The base class for all musical tag classes.
Definition: ARMusicalTag.h:34
NVstring
Definition: nvstring.h:21
NVRect
Definition: NVRect.h:22
ARTHead::HEADSTATE
HEADSTATE
Definition: ARTHead.h:80
GRSingleNote::getStemDirSet
virtual bool getStemDirSet() const
Definition: GRSingleNote.h:99
GRSingleNote::getEnclosingBox
NVRect getEnclosingBox(bool includeAccidentals=true, bool includeSlurs=true, bool includeTrills=true) const
GRBeam
The Beam notation element.
Definition: GRBeam.h:79
GuidoElementSelector
GuidoElementSelector
Definition: GUIDOScoreMap.h:40
GRGlobalStem
Shared stem.
Definition: GRGlobalStem.h:36
ARNote
Representation of a GUIDO note.
Definition: ARNote.h:30
GRStem
Graphical representation of a stem.
Definition: GRStem.h:28
GRSingleNote::setStemOffsetStartPosition
virtual void setStemOffsetStartPosition(float inOffset)
GRSingleNote::getFlag
GRFlag * getFlag()
GRSingleNote::changeStemLength
virtual float changeStemLength(float inLen, bool force=false)
GRSingleNote::getNoteHead
GRStdNoteHead * getNoteHead() const
GREvent::mSize
float mSize
Definition: GREvent.h:149
GRSingleNote::getHeadState
ARTHead::HEADSTATE getHeadState()
Definition: GRSingleNote.h:118
GRSingleNote::addArticulation
virtual void addArticulation(const ARMusicalTag *mtag)
GRSingleNote::addToOffset
virtual void addToOffset(const NVPoint &pt)
GRSingleNote::adjustLength
virtual int adjustLength(const TYPE_DURATION &ndur)
GRSingleNote::setHPosition
virtual void setHPosition(float inX)
GRSingleNote::drawStemOnly
virtual void drawStemOnly(int flag)
GRSingleNote::userLength
virtual bool userLength() const
Definition: GRSingleNote.h:101
GRSingleNote::setStemLength
virtual float setStemLength(float inLen, bool userLength=false)
GRSingleNote::~GRSingleNote
virtual ~GRSingleNote()
Definition: GRSingleNote.h:44

Guido Project Copyright © 2019 Grame-CNCM