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 
93  void SetDrawingTextInkBounds(int top, int bottom)
94  {
95  m_drawingTextInkTop = top;
96  m_drawingTextInkBottom = bottom;
97  m_hasDrawingTextInkBounds = true;
98  }
99  void ResetDrawingTextInkBounds() { m_hasDrawingTextInkBounds = false; }
100  bool HasDrawingTextInkBounds() const { return m_hasDrawingTextInkBounds; }
101  int GetDrawingTextInkTop() const { return m_drawingTextInkTop; }
102  int GetDrawingTextInkBottom() const { return m_drawingTextInkBottom; }
103 
107  bool IsEmpty() const;
108 
109  //----------------//
110  // Static methods //
111  //----------------//
112 
116  static void AdjustToLyricSize(const Doc *doc, int &value);
117 
118  //----------//
119  // Functors //
120  //----------//
121 
126  FunctorCode Accept(Functor &functor) override;
127  FunctorCode Accept(ConstFunctor &functor) const override;
128  FunctorCode AcceptEnd(Functor &functor) override;
129  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
131 
132 private:
133  //
134 public:
143  data_STAFFREL m_drawingVersePlace;
144 
150 
151 private:
152  int m_drawingTextInkTop;
153  int m_drawingTextInkBottom;
154  bool m_hasDrawingTextInkBounds;
155 };
156 
157 } // namespace vrv
158 
159 #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:66
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:149
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 IsEmpty() const
Return true when the syl has no textual content.
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:143
int m_drawingVoltaN
The normalized volta row within the verse (one by default).
Definition: syl.h:141
int CalcHyphenLength(Doc *doc, int staffSize)
Calculate the hyphen length using the text font.
void SetDrawingTextInkBounds(int top, int bottom)
Store and retrieve the actual glyph-ink bounds calculated while drawing the syllable text.
Definition: syl.h:93
int m_drawingVerseN
The verse number with multiple verses Value is 1 by default, set in PrepareLyrics.
Definition: syl.h:139
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:1031
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145