Verovio
Source code documentation
page.h
1 // Name: page.h
3 // Author: Laurent Pugin
4 // Created: 2005
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_PAGE_H__
9 #define __VRV_PAGE_H__
10 
11 #include "object.h"
12 #include "scoredef.h"
13 
14 namespace vrv {
15 
16 class DeviceContext;
17 class RunningElement;
18 class Score;
19 class Staff;
20 class System;
21 
22 //----------------------------------------------------------------------------
23 // Page
24 //----------------------------------------------------------------------------
25 
31 class Page : public Object {
32 public:
38  Page();
39  virtual ~Page();
40  void Reset() override;
41  std::string GetClassName() const override { return "page"; }
43 
48  bool IsSupportedChild(ClassId classId) override;
50 
55  double GetPPUFactor() const { return m_PPUFactor; }
56  void SetPPUFactor(double PPUFactor) { m_PPUFactor = PPUFactor; }
58 
63  bool IsFirstOfSelection() const;
64  bool IsLastOfSelection() const;
66 
72  RunningElement *GetHeader();
73  const RunningElement *GetHeader() const;
74  RunningElement *GetFooter();
75  const RunningElement *GetFooter() const;
77 
81  int GetPageIdx() const { return Object::GetIdx(); }
82 
88  void LayOut();
89  void DeprecateLayout() { m_layoutDone = false; }
90 
95  void LayOutTranscription(bool force = false);
96 
101 
107  void LayOutHorizontallyWithCache(bool restore = false);
108 
113 
118 
123 
128 
133 
139  int GetContentHeight() const;
140 
147  int GetContentWidth() const;
148 
149  //----------//
150  // Functors //
151  //----------//
152 
157  FunctorCode Accept(Functor &functor) override;
158  FunctorCode Accept(ConstFunctor &functor) const override;
159  FunctorCode AcceptEnd(Functor &functor) override;
160  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
162 
163 private:
167  void AdjustSylSpacingByVerse(const IntTree &verseTree, Doc *doc);
168 
172  void ReduceJustifiableHeight(const Doc *doc);
173 
174  //
175 public:
192  std::string m_surface;
193 
201 
207  Score *m_score;
208  Score *m_scoreEnd;
210 
214  double m_PPUFactor;
215 
221 
227 
228 private:
234  bool m_layoutDone;
235 };
236 
237 } // namespace vrv
238 
239 #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 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 page in a laid-out score (Doc).
Definition: page.h:31
void LayOut()
Do the layout of the page, which means aligning its content horizontally and vertically,...
void JustifyHorizontally()
Justifiy the content of the page (measures and their content) horizontally.
int GetContentWidth() const
Return the width of the content by looking at the first system of the page.
void LayOutTranscription(bool force=false)
Do the layout for a transcription page (with layout information).
bool IsSupportedChild(ClassId classId) override
Base method for checking if a child can be added.
void ResetAligners()
Reset and set the horizontal and vertical alignment.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
std::string m_surface
Surface (MEI @surface).
Definition: page.h:192
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
void LayOutHorizontallyWithCache(bool restore=false)
Lay out the measures horizontally using the cached values.
int m_pageMarginLeft
Page left margin (MEI scoredef@page.leftmar).
Definition: page.h:183
int m_pageMarginTop
Page top margin (MEI scoredef@page.topmar).
Definition: page.h:187
void JustifyVertically()
Justifiy the content of the page (system/staves) vertically.
int m_pageHeight
Page height (MEI scoredef@page.height).
Definition: page.h:179
int m_pageMarginBottom
Page bottom margin (MEI scoredef@page.botmar).
Definition: page.h:181
int m_pageWidth
Page width (MEI scoredef@page.width).
Definition: page.h:177
void LayOutPitchPos()
Lay out the pitch positions and stems (without redoing the entire layout)
void LayOutHorizontally()
Lay out the content of the page (measures and their content) horizontally.
int m_pageMarginRight
Page right margin (MEI scoredef@page.rightmar).
Definition: page.h:185
ScoreDef m_drawingScoreDef
Hold the top scoreDef of the page.
Definition: page.h:200
int m_drawingJustifiableHeight
The height that can be justified once the systems are aligned.
Definition: page.h:220
void LayOutVertically()
Lay out the content of the page (system/staves) vertically.
int GetPageIdx() const
Return the index position of the page in its document parent.
Definition: page.h:81
double m_PPUFactor
Temporary member that will be replace by its LibMEI equivalent in the next version of the page-based ...
Definition: page.h:214
int GetContentHeight() const
Return the height of the content by looking at the last system of the page.
double m_justificationSum
the sum of justification factors for each type of spacing in between systems and staves (staff,...
Definition: page.h:226
This class represents a MEI scoreDef.
Definition: scoredef.h:135
This class represent a <score> in MEI.
Definition: score.h:30
Generic int map recursive structure for storing hierachy of values For example, we want to process al...
Definition: vrvdef.h:422