Verovio
Source code documentation
ossia.h
1 // Name: ossia.h
3 // Author: Klaus Rettinghaus
4 // Created: 2025
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_OSSIA_H__
9 #define __VRV_OSSIA_H__
10 
11 #include "atts_cmn.h"
12 #include "atts_shared.h"
13 #include "barline.h"
14 #include "object.h"
15 #include "staffgrp.h"
16 
17 namespace vrv {
18 
19 class StaffDef;
20 
21 //----------------------------------------------------------------------------
22 // Ossia
23 //----------------------------------------------------------------------------
24 
28 class Ossia : public Object, public AttTyped {
29 
30 public:
36  Ossia();
37  virtual ~Ossia();
38  Object *Clone() const override { return new Ossia(*this); };
39  void Reset() override;
40  std::string GetClassName() const override { return "ossia"; }
42 
46  void CloneReset() override;
47 
52  void AddDrawingStaffDef(StaffDef *drawingStaffDef);
53  void ResetDrawingStaffGrp();
54  StaffGrp *GetDrawingStaffGrp() { return &m_drawingStaffGrp; }
56 
61  bool HasShowScoreDef() const;
62  data_BOOLEAN GetShowScoreDef() const;
63  bool HasShowBarLines() const;
64  data_BOOLEAN GetShowBarLines() const;
66 
71  bool IsFirst() const { return (m_isFirst); }
72  void SetFirst(bool isFirst) { m_isFirst = isFirst; }
73  bool IsLast() const { return (m_isLast); }
74  void SetLast(bool isLast) { m_isLast = isLast; }
76 
80  bool HasMultipleOStaves() const;
81 
85  bool DrawScoreDef() const;
86 
90  const Staff *GetOriginalStaffForOssia(const Staff *ossia) const;
91 
96  void SetClefAlignment(Alignment *clefAlignment) { m_clefAlignment = clefAlignment; }
97  void SetKeySigAlignment(Alignment *keySigAlignment) { m_keySigAlignment = keySigAlignment; }
98  void ResetAlignments();
100 
104  int GetScoreDefShift() const;
105 
109  bool IsSupportedChild(ClassId classId) override;
110 
115  void GetStavesAbove(MapOfOssiaStaffNs &map) const;
116  void GetStavesBelow(MapOfOssiaStaffNs &map) const;
118 
123  const Staff *GetDrawingTopOStaff() const;
124  const Staff *GetDrawingBottopOStaff() const;
126 
130  BarLine *GetDrawingLeftBarLine() { return &m_drawingLeftBarLine; }
131 
135  std::vector<int> GetOStaffNs() const;
136 
137  //----------//
138  // Functors //
139  //----------//
140 
145  FunctorCode Accept(Functor &functor) override;
146  FunctorCode Accept(ConstFunctor &functor) const override;
147  FunctorCode AcceptEnd(Functor &functor) override;
148  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
150 
151 private:
155  void GetStaves(MapOfOssiaStaffNs &map, ListOfConstObjects &staves) const;
156 
157 public:
158  //
159 protected:
160  //
161 private:
163  StaffGrp m_drawingStaffGrp;
165  bool m_isFirst;
167  bool m_isLast;
169  Alignment *m_clefAlignment;
170  Alignment *m_keySigAlignment;
172  BarLine m_drawingLeftBarLine;
173 };
174 
175 } // namespace vrv
176 
177 #endif
This class stores an alignment position elements will point to.
Definition: horizontalaligner.h:75
This class models the MEI <barLine> element.
Definition: barline.h:34
This abstract class is the base class for all const functors.
Definition: functor.h:126
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class represents a basic object.
Definition: object.h:64
This class represents an ossia.
Definition: ossia.h:28
std::vector< int > GetOStaffNs() const
Return the staff @n of oStaff in the order they appear.
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
BarLine * GetDrawingLeftBarLine()
Return the drawing left bar line.
Definition: ossia.h:130
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool DrawScoreDef() const
Show scoreDef at drawing depending on the number of staves and the attribute values.
Object * Clone() const override
Method call for copying child classes.
Definition: ossia.h:38
int GetScoreDefShift() const
Return the ossia scoreDef shift using the clef and keySig alignments.
bool IsSupportedChild(ClassId classId) override
Methods for adding allowed content.
void CloneReset() override
Overriding CloneReset() method to be called after copy / assignment calls.
const Staff * GetOriginalStaffForOssia(const Staff *ossia) const
Retrieve the original staff corresponding to the ossia staff.
bool HasMultipleOStaves() const
Return true if the ossia element as more than one oStaff.
This class represents a MEI staffDef.
Definition: staffdef.h:37
This class represents a MEI staffGrp.
Definition: staffgrp.h:39
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:110