8 #ifndef __VRV_ACCID_H__
9 #define __VRV_ACCID_H__
11 #include "atts_externalsymbols.h"
12 #include "atts_gestural.h"
13 #include "floatingobject.h"
14 #include "layerelement.h"
15 #include "offsetinterface.h"
16 #include "positioninterface.h"
20 class AlignmentReference;
21 class AccidFloatingObject;
34 public AttAccidentalGes,
37 public AttEnclosingChars,
39 public AttExtSymNames,
40 public AttPlacementOnStaff,
41 public AttPlacementRelEvent {
52 std::string GetClassName()
const override {
return "accid"; }
65 bool IsRelativeToStaff()
const override {
return (this->HasLoc() || (this->HasOloc() && this->HasPloc())); }
71 OffsetInterface *GetOffsetInterface()
override {
return vrv_cast<OffsetInterface *>(
this); }
72 const OffsetInterface *GetOffsetInterface()
const override {
return vrv_cast<const OffsetInterface *>(
this); }
73 PositionInterface *GetPositionInterface()
override {
return vrv_cast<PositionInterface *>(
this); }
74 const PositionInterface *GetPositionInterface()
const override {
return vrv_cast<const PositionInterface *>(
this); }
84 void SetDrawingUnisonAccid(
Accid *drawingUnison) { m_drawingUnison = drawingUnison; }
85 Accid *GetDrawingUnisonAccid() {
return m_drawingUnison; }
86 const Accid *GetDrawingUnisonAccid()
const {
return m_drawingUnison; }
99 std::set<Accid *> &adjustedAccids);
110 void IsAlignedWithSameLayer(
bool alignWithSameLayer) { m_alignedWithSameLayer = alignWithSameLayer; }
111 bool IsAlignedWithSameLayer()
const {
return m_alignedWithSameLayer; }
121 static char32_t GetAccidGlyph(data_ACCIDENTAL_WRITTEN accid);
126 static std::u32string
CreateSymbolStr(data_ACCIDENTAL_WRITTEN accid, data_ENCLOSURE enclosure = ENCLOSURE_NONE,
127 data_NOTATIONTYPE notationType = NOTATIONTYPE_NONE,
const Resources *resources = NULL, data_HEXNUM glyphNum = 0,
128 std::string glyphName =
"");
140 FunctorCode AcceptEnd(
Functor &functor)
override;
141 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
149 Accid *m_drawingUnison;
150 bool m_alignedWithSameLayer;
172 std::string GetClassName()
const override {
return "accid"; }
196 bool operator()(
const Accid *first,
const Accid *second)
const
198 if (first->GetDrawingY() == second->GetDrawingY()) {
200 return ((first->GetAccid() == ACCIDENTAL_WRITTEN_n) && (second->GetAccid() != ACCIDENTAL_WRITTEN_n));
203 return (first->GetDrawingY() > second->GetDrawingY());
221 std::string GetOctaveID(
const Accid *accid)
const;
223 bool operator()(
const Accid *first,
const Accid *second)
const
225 return this->GetOctaveID(first) < this->GetOctaveID(second);
This class is used for editorial accidentals to be laid out as floating objects.
Definition: accid.h:163
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
This class models the MEI <accid> element.
Definition: accid.h:41
void AdjustToLedgerLines(const Doc *doc, LayerElement *element, int staffSize)
Adjust accid position if it's placed above/below staff so that it does not overlap with ledger lines.
void InitFloatingObject()
Init the accid floating object for editorial accidentals.
bool HasToBeAligned() const override
Override the method since alignment is required.
Definition: accid.h:78
void AdjustX(LayerElement *element, const Doc *doc, int staffSize, std::vector< Accid * > &leftAccids, std::set< Accid * > &adjustedAccids)
Adjust X position of accid in relation to other element.
void Reset() override
Virtual reset method.
static std::u32string CreateSymbolStr(data_ACCIDENTAL_WRITTEN accid, data_ENCLOSURE enclosure=ENCLOSURE_NONE, data_NOTATIONTYPE notationType=NOTATIONTYPE_NONE, const Resources *resources=NULL, data_HEXNUM glyphNum=0, std::string glyphName="")
Create the SMuFL string based on various properties.
Object * Clone() const override
Method call for copying child classes.
Definition: accid.h:50
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool IsRelativeToStaff() const override
Override the method since it is align to the staff.
Definition: accid.h:65
AccidFloatingObject * GetFloatingObject()
Return the floating object (NULL if not set)
Definition: accid.h:62
void ClearFloatingObject()
Delete the floating object (editorial accidental) on reset or deletion.
std::u32string GetSymbolStr(data_NOTATIONTYPE notationType) const
Retrieve SMuFL string for the accidental.
Equivalence of accidentals that are an octave apart.
Definition: accid.h:215
Sort Object by drawing Y value.
Definition: accid.h:191
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 class represents elements appearing within a measure.
Definition: floatingobject.h:28
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
This class is an interface for elements with a position on the staff, such as rests.
Definition: positioninterface.h:30
This class provides resource values.
Definition: resources.h:30