Verovio
Source code documentation
syl.h
1 // Name: syl.h
3 // Author: Laurent Pugin
4 // Created: 2014
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_SYL_H__
9 #define __VRV_SYL_H__
10 
11 #include "atts_shared.h"
12 #include "facsimileinterface.h"
13 #include "layerelement.h"
14 #include "offsetinterface.h"
15 #include "timeinterface.h"
16 
17 namespace vrv {
18 
19 class Note;
20 class TextElement;
21 
22 //----------------------------------------------------------------------------
23 // Syl
24 //----------------------------------------------------------------------------
25 
32 class Syl : public LayerElement,
33  public TextListInterface,
34  public OffsetInterface,
35  public TimeSpanningInterface,
36  public AttLang,
37  public AttTypography,
38  public AttSylLog {
39 public:
45  Syl();
46  virtual ~Syl();
47  Object *Clone() const override { return new Syl(*this); }
48  void Reset() override;
49  std::string GetClassName() const override { return "syl"; }
51 
53  bool IsRelativeToStaff() const override { return true; }
54 
59  OffsetInterface *GetOffsetInterface() override { return vrv_cast<OffsetInterface *>(this); }
60  const OffsetInterface *GetOffsetInterface() const override { return vrv_cast<const OffsetInterface *>(this); }
61  TimePointInterface *GetTimePointInterface() override { return vrv_cast<TimePointInterface *>(this); }
62  const TimePointInterface *GetTimePointInterface() const override
63  {
64  return vrv_cast<const TimePointInterface *>(this);
65  }
66  TimeSpanningInterface *GetTimeSpanningInterface() override { return vrv_cast<TimeSpanningInterface *>(this); }
67  const TimeSpanningInterface *GetTimeSpanningInterface() const override
68  {
69  return vrv_cast<const TimeSpanningInterface *>(this);
70  }
72 
77  bool IsSupportedChild(ClassId classId) override;
78 
82  int CalcHyphenLength(Doc *doc, int staffSize);
83 
87  int CalcConnectorSpacing(Doc *doc, int staffSize);
88 
89  int GetDrawingWidth() const;
90  int GetDrawingHeight() const;
91 
92  //----------------//
93  // Static methods //
94  //----------------//
95 
99  static void AdjustToLyricSize(const Doc *doc, int &value);
100 
101  //----------//
102  // Functors //
103  //----------//
104 
109  FunctorCode Accept(Functor &functor) override;
110  FunctorCode Accept(ConstFunctor &functor) const override;
111  FunctorCode AcceptEnd(Functor &functor) override;
112  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
114 
116  bool CreateDefaultZone(Doc *doc);
117 
118 private:
119  //
120 public:
127  data_STAFFREL m_drawingVersePlace;
128 
134 
135 private:
136 };
137 
138 } // namespace vrv
139 
140 #endif
This abstract class is the base class for all const functors.
Definition: functor.h:126
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a basic object.
Definition: object.h:64
This class is an interface for elements having a single visual offset, such as arpeg,...
Definition: offsetinterface.h:28
Syl is a TimeSpanningInterface for managing syllable connectors.
Definition: syl.h:38
static void AdjustToLyricSize(const Doc *doc, int &value)
Adjust proportionally to the lyric size.
void Reset() override
Virtual reset method.
bool IsSupportedChild(ClassId classId) override
Add an element (text, rend.
Syl * m_nextWordSyl
A pointer to the next syllable of the word.
Definition: syl.h:133
Object * Clone() const override
Method call for copying child classes.
Definition: syl.h:47
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool CreateDefaultZone(Doc *doc)
Create a default zone for a syl based on syllable.
bool IsRelativeToStaff() const override
Override the method since it is align to the staff.
Definition: syl.h:53
int CalcConnectorSpacing(Doc *doc, int staffSize)
Calculate the spacing needed depending on the @worpos and @con.
data_STAFFREL m_drawingVersePlace
The verse place (below by default)
Definition: syl.h:127
int CalcHyphenLength(Doc *doc, int staffSize)
Calculate the hyphen length using the text font.
int m_drawingVerseN
The verse number with multiple verses Value is 1 by default, set in PrepareLyrics.
Definition: syl.h:125
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:1007
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145