GUIDOLib  1.7.7
Guido Engine Internal Documentation
GREvent.h
1 #ifndef GREvent_H
2 #define GREvent_H
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2002 Holger Hoos, Juergen Kilian, Kai Renz
7  Copyright (C) 2003, 2004 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 <vector>
19 
20 #include "GRARCompositeNotationElement.h"
21 
22 class NVPoint;
23 
24 class ARDotFormat;
25 class ARMusicalEvent;
26 class ARMusicalTag;
27 
28 class GRBeam;
29 class GRStaff;
30 class GRGlobalStem;
31 class GRGlobalLocation;
32 class GRBar;
33 class GRNotationElement;
34 class GRNoteDot;
35 class GRArticulation;
36 
37 
38 template <typename TYPE>
39 void DeleteContent( TYPE * inContainer )
40 {
41  if( inContainer == 0 ) return;
42 
43  typename TYPE::iterator thePtr;
44  for( thePtr = inContainer->begin(); thePtr != inContainer->end(); ++thePtr )
45  delete *thePtr;
46 
47  inContainer->clear();
48 }
49 
50 // template <class T> class KF_IPointerList;
51 // typedef KF_IPointerList<GRNotationElement> GRNEList;
52 
53 typedef std::vector<GRArticulation *> GRNEList;
54 
62 {
63  public:
64  GREvent( GRStaff * inStaff, const ARMusicalEvent * ar, bool p_ownsAR = false );
65  GREvent(GRStaff * inStaff, const ARMusicalEvent * ar, const TYPE_TIMEPOSITION & date, const TYPE_DURATION & dur);
66 
67  virtual ~GREvent();
68 
69  virtual void addToOffset(const NVPoint & offs);
70 
71  // this can be used by the derived classes
72  // to find out about size. Will be set by noteFormat
73  virtual float getSize() const { return mSize; }
74 
75  // the offset is a global offset (defined with noteFormat ...)
76  virtual const NVPoint & getOffset() const { return mOffset; }
77 
78  virtual const NVstring & getStyle() const { return mStyle; }
79  virtual const unsigned char * getColRef() const { return mColRef; }
80 
81  virtual void setSize(float nsize) { mSize = nsize; }
82 
83  virtual void addArticulation( const ARMusicalTag * inTag );
84  bool hasArticulation( int inArticulationFlag ) const;
85 
86  virtual int adjustLength (const TYPE_DURATION & ndur );
87 
88  virtual NVPoint getCrescEnd();
89  virtual NVPoint getCrescStart();
90 
91  virtual void setHPosition( float inX );
92  virtual void setPosition( const NVPoint & inPos );
93 
94  virtual void updateBoundingBox();
95 
96  // - Stem stuff
97  virtual GRGlobalStem * getGlobalStem() const { return mGlobalStem; }
98  virtual void setGlobalStem( GRGlobalStem * inGlobalStem );
99  virtual void setGlobalLocation(GRGlobalLocation * pglog);
100 
101  virtual void setBeamStem( GRBeam * inBeam, float pos);
102  virtual float setStemLength( float inLen, bool userLength = false );
103 
104  virtual GDirection getStemDirection() const;
105 
106  virtual void setStemDirection( GDirection dir );
107  virtual void setFlagOnOff(bool i);
108 
109  virtual bool getStemDirSet() const;
110  virtual bool getStemLengthSet() const;
111  virtual float getStemLength() const;
112 
113  virtual NVPoint getStemStartPos() const;
114  virtual NVPoint getStemEndPos() const;
115 
116 
117  virtual float changeStemLength( float inLen, bool force = false );
118  virtual int getNumFaehnchen() const;
119  virtual int getBeamCount() const { return mBeamCount; }
120  virtual void incBeamCount() { ++ mBeamCount; }
121  virtual void decBeamCount() { -- mBeamCount; }
122  virtual void setFillsBar(bool value, GRNotationElement *, GRNotationElement *, bool) { mFillsBar = value; }
123 
124  virtual bool getFillsBar() const { return mFillsBar; }
125 
126  bool isSyncopated() const;
127 
128  // - Duration dot
129  virtual void createDots( const TYPE_DURATION & duration, float notewidth, const NVPoint & inPos );
130  virtual void setDotFormat( const ARDotFormat * inFormat );
131  virtual void setDotFormat( GRNoteDot * inDot, const ARDotFormat * inFormat );
132 
133  virtual bool isGREventClass() const { return true; }
134  static GREvent * cast( GObject * inObj ) { return ( inObj->isGREventClass() ? static_cast<GREvent *>(inObj) : 0 ); }
135 
136  const GRNEList& getArticulations() const { return mArtilist; }
137  GRNEList& getArticulations() { return mArtilist; }
138  virtual bool stemHasBeenChanged() const {return stemChanged;}
139  virtual void setStemChanged() {stemChanged = true;}
140  virtual const GREvent * isGREvent() const { return this; }
141  virtual GREvent * isGREvent() { return this; }
142 
143  GRNoteDot * getDot() const;
144 
145  protected:
149  float mSize;
150  unsigned char * mColRef;
152 
153  // this just remembers the LSPACE that is valid at time of creation (staffFormat-Tag and consorts)
154  float mCurLSPACE;
155  // pointer to a global stem, if present. This means, that this note shares a stem with other events...
157 
158  bool mFillsBar;
160 
161  private:
162  GRNEList mArtilist; // our list of articulations.
163 };
164 
165 #endif
GREvent::isGREvent
virtual const GREvent * isGREvent() const
Definition: GREvent.h:140
GRBar
Measure bar.
Definition: GRBar.h:29
GREvent::getStemDirSet
virtual bool getStemDirSet() const
GREvent::cast
static GREvent * cast(GObject *inObj)
Definition: GREvent.h:134
GRNoteDot
This class provides a note with a stem and a correct flag.
Definition: GRNoteDot.h:29
GREvent::getStemStartPos
virtual NVPoint getStemStartPos() const
GREvent::setSize
virtual void setSize(float nsize)
Definition: GREvent.h:81
GREvent::mBeamCount
int mBeamCount
Definition: GREvent.h:151
GREvent::getStyle
virtual const NVstring & getStyle() const
Definition: GREvent.h:78
GREvent::changeStemLength
virtual float changeStemLength(float inLen, bool force=false)
GREvent::setFillsBar
virtual void setFillsBar(bool value, GRNotationElement *, GRNotationElement *, bool)
Definition: GREvent.h:122
GREvent::mColRef
unsigned char * mColRef
Definition: GREvent.h:150
duration
GuidoDate duration(CGRHandler inHandleGR)
Returns the music duration of a score.
ARMusicalEvent
Class for musical events (events have an own duration tags not)
Definition: ARMusicalEvent.h:26
GObject
The base class for all graphic objects.
Definition: GObject.h:54
GREvent::setDotFormat
virtual void setDotFormat(const ARDotFormat *inFormat)
GREvent::getStemLength
virtual float getStemLength() const
GREvent::getArticulations
GRNEList & getArticulations()
Definition: GREvent.h:137
Fraction
Numerator and denominator.
Definition: Fraction.h:23
GObject::isGREventClass
virtual bool isGREventClass() const
Definition: GObject.h:92
GREvent::getFillsBar
virtual bool getFillsBar() const
Definition: GREvent.h:124
GREvent::getStemEndPos
virtual NVPoint getStemEndPos() const
GRNotationElement
parent class for all notation elements.
Definition: GRNotationElement.h:54
GREvent::getSize
virtual float getSize() const
Definition: GREvent.h:73
GREvent
Graphical representation for an event (= has duration).
Definition: GREvent.h:61
GREvent::getBeamCount
virtual int getBeamCount() const
Definition: GREvent.h:119
GREvent::~GREvent
virtual ~GREvent()
NVPoint
Definition: NVPoint.h:20
GREvent::incBeamCount
virtual void incBeamCount()
Definition: GREvent.h:120
GREvent::mArticulationFlags
int mArticulationFlags
Definition: GREvent.h:146
GRStaff
A GRStaff represents a single line of music.
Definition: GRStaff.h:181
ARDotFormat
not yet documented
Definition: ARDotFormat.h:40
GREvent::isSyncopated
bool isSyncopated() const
GREvent::getDot
GRNoteDot * getDot() const
GREvent::getCrescStart
virtual NVPoint getCrescStart()
GREvent::getStemDirection
virtual GDirection getStemDirection() const
GREvent::GREvent
GREvent(GRStaff *inStaff, const ARMusicalEvent *ar, bool p_ownsAR=false)
GREvent::getStemLengthSet
virtual bool getStemLengthSet() const
GREvent::mGlobalStem
GRGlobalStem * mGlobalStem
Definition: GREvent.h:156
GREvent::setStemChanged
virtual void setStemChanged()
Definition: GREvent.h:139
GREvent::isGREvent
virtual GREvent * isGREvent()
Definition: GREvent.h:141
GREvent::hasArticulation
bool hasArticulation(int inArticulationFlag) const
GRGlobalLocation
not yet documented
Definition: GRGlobalLocation.h:30
GREvent::stemHasBeenChanged
virtual bool stemHasBeenChanged() const
Definition: GREvent.h:138
GREvent::setHPosition
virtual void setHPosition(float inX)
GREvent::mFillsBar
bool mFillsBar
Definition: GREvent.h:158
GREvent::getArticulations
const GRNEList & getArticulations() const
Definition: GREvent.h:136
GREvent::setPosition
virtual void setPosition(const NVPoint &inPos)
GREvent::setFlagOnOff
virtual void setFlagOnOff(bool i)
GREvent::setBeamStem
virtual void setBeamStem(GRBeam *inBeam, float pos)
GREvent::setGlobalLocation
virtual void setGlobalLocation(GRGlobalLocation *pglog)
GREvent::mCurLSPACE
float mCurLSPACE
Definition: GREvent.h:154
GREvent::updateBoundingBox
virtual void updateBoundingBox()
ARMusicalTag
The base class for all musical tag classes.
Definition: ARMusicalTag.h:34
GREvent::getNumFaehnchen
virtual int getNumFaehnchen() const
NVstring
Definition: nvstring.h:21
GREvent::addToOffset
virtual void addToOffset(const NVPoint &offs)
GREvent::isGREventClass
virtual bool isGREventClass() const
Definition: GREvent.h:133
GREvent::getGlobalStem
virtual GRGlobalStem * getGlobalStem() const
Definition: GREvent.h:97
GRBeam
The Beam notation element.
Definition: GRBeam.h:79
GREvent::setStemDirection
virtual void setStemDirection(GDirection dir)
GREvent::adjustLength
virtual int adjustLength(const TYPE_DURATION &ndur)
GREvent::mOffset
NVPoint mOffset
Definition: GREvent.h:148
GRArticulation
Articulations: staccato, accent, marcato, tenuto, fermata, breath-mark, harmonics.
Definition: GRArticulation.h:35
GREvent::getOffset
virtual const NVPoint & getOffset() const
Definition: GREvent.h:76
GREvent::mStyle
NVstring mStyle
Definition: GREvent.h:147
GRGlobalStem
Shared stem.
Definition: GRGlobalStem.h:36
GREvent::addArticulation
virtual void addArticulation(const ARMusicalTag *inTag)
GREvent::setStemLength
virtual float setStemLength(float inLen, bool userLength=false)
GREvent::stemChanged
bool stemChanged
Definition: GREvent.h:159
GREvent::decBeamCount
virtual void decBeamCount()
Definition: GREvent.h:121
GREvent::setGlobalStem
virtual void setGlobalStem(GRGlobalStem *inGlobalStem)
GREvent::createDots
virtual void createDots(const TYPE_DURATION &duration, float notewidth, const NVPoint &inPos)
GREvent::getColRef
virtual const unsigned char * getColRef() const
Definition: GREvent.h:79
GREvent::getCrescEnd
virtual NVPoint getCrescEnd()
GREvent::mSize
float mSize
Definition: GREvent.h:149
GRARCompositeNotationElement
not yet documented
Definition: GRARCompositeNotationElement.h:25

Guido Project Copyright © 2019 Grame-CNCM