Verovio
Source code documentation
system.h
1 // Name: system.h
3 // Author: Laurent Pugin
4 // Created: 2011
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_SYSTEM_H__
9 #define __VRV_SYSTEM_H__
10 
11 #include "drawinginterface.h"
12 #include "editorial.h"
13 #include "object.h"
14 #include "verticalaligner.h"
15 #include "vrvdef.h"
16 
17 namespace vrv {
18 
19 class SystemMilestoneEnd;
20 class DeviceContext;
21 class Ending;
22 class Measure;
23 class ScoreDef;
24 class Slur;
25 class Staff;
26 
27 //----------------------------------------------------------------------------
28 // System
29 //----------------------------------------------------------------------------
30 
36 class System : public Object, public DrawingListInterface, public AttTyped {
37 public:
43  System();
44  virtual ~System();
45  void Reset() override;
46  std::string GetClassName() const override { return "system"; }
48 
53  bool IsSupportedChild(ClassId classId) override;
55 
60  int GetDrawingX() const override;
61  int GetDrawingY() const override;
63 
68  int GetDrawingXRel() const { return m_drawingXRel; }
69  virtual void SetDrawingXRel(int drawingXRel);
70  int GetDrawingYRel() const { return m_drawingYRel; }
71  virtual void SetDrawingYRel(int drawingYRel);
73 
78  int GetDrawingLabelsWidth() const;
79  void SetDrawingLabelsWidth(int width);
80  int GetDrawingAbbrLabelsWidth() const { return m_drawingAbbrLabelsWidth; }
81  void SetDrawingAbbrLabelsWidth(int width);
82  void ResetDrawingAbbrLabelsWidth() { m_drawingAbbrLabelsWidth = 0; }
84 
88  int GetHeight() const;
89 
96  const Staff *GetTopVisibleStaff() const;
98 
102  int GetMinimumSystemSpacing(const Doc *doc) const;
103 
107  int GetSystemIdx() const { return Object::GetIdx(); }
108 
109  bool SetCurrentFloatingPositioner(
110  int staffN, FloatingObject *object, Object *objectX, Object *objectY, char spanningType = SPANNING_START_END);
111 
116  ScoreDef *GetDrawingScoreDef() { return m_drawingScoreDef; }
117  const ScoreDef *GetDrawingScoreDef() const { return m_drawingScoreDef; }
118  void SetDrawingScoreDef(ScoreDef *drawingScoreDef);
119  void ResetDrawingScoreDef();
121 
126  bool HasMixedDrawingStemDir(const LayerElement *start, const LayerElement *end) const;
127 
131  curvature_CURVEDIR GetPreferredCurveDirection(
132  const LayerElement *start, const LayerElement *end, const Slur *slur) const;
133 
138  bool IsDrawingOptimized() const { return m_drawingIsOptimized; }
139  void IsDrawingOptimized(bool drawingIsOptimized) { m_drawingIsOptimized = drawingIsOptimized; }
141 
147 
153  bool IsFirstInPage() const;
154  bool IsLastInPage() const;
155  bool IsFirstOfMdiv() const;
156  bool IsLastOfMdiv() const;
157  bool IsFirstOfSelection() const;
158  bool IsLastOfSelection() const;
160 
164  double EstimateJustificationRatio(const Doc *doc) const;
165 
170 
171  //----------//
172  // Functors //
173  //----------//
174 
179  FunctorCode Accept(Functor &functor) override;
180  FunctorCode Accept(ConstFunctor &functor) const override;
181  FunctorCode AcceptEnd(Functor &functor) override;
182  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
184 
185 public:
186  SystemAligner m_systemAligner;
187 
188 public:
213  int m_drawingTotalWidth;
214  int m_drawingJustifiableWidth;
216 
222  int m_castOffTotalWidth;
223  int m_castOffJustifiableWidth;
225 
226 protected:
237 
238 private:
242  ScoreDef *m_drawingScoreDef;
243 
248  bool m_drawingIsOptimized;
249 };
250 
251 } // namespace vrv
252 
253 #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 class is an interface for elements with duration, such as notes and rests.
Definition: drawinginterface.h:33
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:61
int GetIdx() const
Return the index position of the object in its parent (-1 if not found)
This class represents a MEI scoreDef.
Definition: scoredef.h:135
Definition: slur.h:57
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:107
This class aligns the content of a system It contains a vector of StaffAlignment.
Definition: verticalaligner.h:31
This class represents a system in a laid-out score (Doc).
Definition: system.h:36
int m_systemRightMar
System right margin (MEI scoredef@system.rightmar).
Definition: system.h:192
int GetMinimumSystemSpacing(const Doc *doc) const
Return the minimus system spacing.
int GetHeight() const
Return the height of the system.
bool IsSupportedChild(ClassId classId) override
Base method for checking if a child can be added.
double EstimateJustificationRatio(const Doc *doc) const
Estimate the justification ratio from the castoff system widths and the desired page width.
int m_drawingAbbrLabelsWidth
The width used by the abbreviated labels at the left of the system.
Definition: system.h:207
void AddToDrawingListIfNecessary(Object *object)
Add an object to the drawing list but only if necessary.
int GetSystemIdx() const
Return the index position of the system in its page parent.
Definition: system.h:107
Staff * GetTopVisibleStaff()
Return the top (first) visible staff in the measure (if any).
int m_drawingFacsY
The Y absolute position of the staff for facsimile (transcription) encodings.
Definition: system.h:197
curvature_CURVEDIR GetPreferredCurveDirection(const LayerElement *start, const LayerElement *end, const Slur *slur) const
Get preferred curve direction based on the starting and ending point of the slur.
int m_drawingXRel
The X relative position of the system.
Definition: system.h:231
int m_drawingYRel
The Y relative position of the system.
Definition: system.h:236
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool HasMixedDrawingStemDir(const LayerElement *start, const LayerElement *end) const
Check if the notes between the start and end have mixed drawing stem directions.
int m_drawingFacsX
The x absolute position of the system for facsimile layouts.
Definition: system.h:202
int m_systemLeftMar
System left margin (MEI scoredef@system.leftmar).
Definition: system.h:190
void ConvertToUnCastOffMensuralSystem()
Reverse of ConvertToCastOffMensural()