11 #include "devicecontextbase.h"
12 #include "expansionmap.h"
13 #include "facsimile.h"
15 #include "resources.h"
32 enum DocType { Raw = 0, Rendering, Transcription, Facs };
51 std::string GetClassName()
const override {
return "body"; }
85 void SetOptions(Options *options) { (*m_options) = *options; }
93 Resources &GetResourcesForModification() {
return m_resources; }
132 void SetType(DocType type);
133 bool IsFacs()
const {
return (m_type == Facs); }
134 bool IsRaw()
const {
return (m_type == Raw); }
135 bool IsRendering()
const {
return (m_type == Rendering); }
136 bool IsTranscription()
const {
return (m_type == Transcription); }
173 Score *GetFirstVisibleScore();
196 int GetGlyphHeight(char32_t code,
int staffSize,
bool graceSize)
const;
197 int GetGlyphWidth(char32_t code,
int staffSize,
bool graceSize)
const;
198 int GetGlyphLeft(char32_t code,
int staffSize,
bool graceSize)
const;
199 int GetGlyphRight(char32_t code,
int staffSize,
bool graceSize)
const;
200 int GetGlyphBottom(char32_t code,
int staffSize,
bool graceSize)
const;
201 int GetGlyphTop(char32_t code,
int staffSize,
bool graceSize)
const;
202 int GetGlyphAdvX(char32_t code,
int staffSize,
bool graceSize)
const;
203 int GetDrawingUnit(
int staffSize)
const;
204 int GetDrawingDoubleUnit(
int staffSize)
const;
205 int GetDrawingStaffSize(
int staffSize)
const;
206 int GetDrawingOctaveSize(
int staffSize)
const;
207 int GetDrawingBrevisWidth(
int staffSize)
const;
208 int GetDrawingBarLineWidth(
int staffSize)
const;
209 int GetDrawingStaffLineWidth(
int staffSize)
const;
210 int GetDrawingStemWidth(
int staffSize)
const;
211 int GetDrawingDirHeight(
int staffSize,
bool withMargin)
const;
212 int GetDrawingDynamHeight(
int staffSize,
bool withMargin)
const;
213 int GetDrawingHairpinSize(
int staffSize,
bool withMargin)
const;
214 int GetDrawingBeamWidth(
int staffSize,
bool graceSize)
const;
215 int GetDrawingBeamWhiteWidth(
int staffSize,
bool graceSize)
const;
216 int GetDrawingLedgerLineExtension(
int staffSize,
bool graceSize)
const;
217 int GetDrawingMinimalLedgerLineExtension(
int staffSize,
bool graceSize)
const;
218 int GetCueSize(
int value)
const;
219 double GetCueScaling()
const;
222 Point ConvertFontPoint(
const Glyph *glyph,
const Point &fontPoint,
int staffSize,
bool graceSize)
const;
229 int GetTextGlyphHeight(char32_t code,
const FontInfo *font,
bool graceSize)
const;
230 int GetTextGlyphWidth(char32_t code,
const FontInfo *font,
bool graceSize)
const;
231 int GetTextGlyphAdvX(char32_t code,
const FontInfo *font,
bool graceSize)
const;
232 int GetTextGlyphDescender(char32_t code,
const FontInfo *font,
bool graceSize)
const;
233 int GetTextLineHeight(
const FontInfo *font,
bool graceSize)
const;
234 int GetTextXHeight(
const FontInfo *font,
bool graceSize)
const;
242 FontInfo *GetDrawingSmuflFont(
int staffSize,
bool graceSize);
243 FontInfo *GetDrawingLyricFont(
int staffSize);
244 FontInfo *GetFingeringFont(
int staffSize);
258 double GetLeftMargin(
const ClassId classId)
const;
259 double GetLeftMargin(
const Object *
object)
const;
260 double GetRightMargin(
const ClassId classId)
const;
261 double GetRightMargin(
const Object *
object)
const;
262 double GetLeftPosition()
const;
263 double GetBottomMargin(
const ClassId classId)
const;
264 double GetTopMargin(
const ClassId classId)
const;
296 bool ExportTimemap(std::string &output,
bool includeRests,
bool includeMeasures,
bool useFractions);
405 void ConvertToMensuralViewDoc();
493 void SetMensuralMusicOnly(data_BOOLEAN isMensuralMusicOnly);
494 bool IsMensuralMusicOnly()
const {
return (m_isMensuralMusicOnly == BOOLEAN_true); }
501 void SetNeumeLines(
bool isNeumeLines) { m_isNeumeLines = isNeumeLines; }
502 bool IsNeumeLines()
const {
return m_isNeumeLines; }
509 void SetFacsimile(Facsimile *facsimile) { m_facsimile = facsimile; }
510 Facsimile *GetFacsimile() {
return m_facsimile; }
511 const Facsimile *GetFacsimile()
const {
return m_facsimile; }
512 bool HasFacsimile()
const {
return m_facsimile != NULL; }
524 void InitSelectionDoc(
DocSelection &selection,
bool resetCache);
525 void ResetSelectionDoc(
bool resetCache);
526 bool HasSelection()
const;
533 void ReactivateSelection(
bool resetAligners);
556 FunctorCode AcceptEnd(
Functor &functor)
override;
557 FunctorCode AcceptEnd(
ConstFunctor &functor)
const override;
564 int CalcMusicFontSize();
569 void PrepareMeasureIndices();
574 void CollectVisibleScores();
582 Page *m_selectionPreceding;
583 Page *m_selectionFollowing;
584 std::string m_selectionStart;
585 std::string m_selectionEnd;
663 std::list<Score *> m_visibleScores;
673 FocusStatusType m_focusStatus;
687 int m_drawingBeamWidth;
689 int m_drawingBeamWhiteWidth;
691 int m_drawingBrevisWidth;
694 int m_drawingSmuflFontSize;
696 int m_drawingLyricFontSize;
698 int m_fingeringFontSize;
711 bool m_currentScoreDefDone;
717 bool m_dataPreparationDone;
724 double m_timemapTempo;
737 data_BOOLEAN m_isMensuralMusicOnly;
750 int m_pageMarginBottom;
752 int m_pageMarginLeft;
754 int m_pageMarginRight;
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
void ScoringUpDoc()
Calls the scoringUpFunctor and applies it.
int m_drawingPageMarginTop
The current page top margin.
Definition: doc.h:627
void ResetDataPage()
Reset drawing page to NULL.
Definition: doc.h:453
float m_drawingBeamMaxSlope
the current beam maximal slope
Definition: doc.h:629
Page * SetDrawingPage(int pageIdx, bool withPageRange=false)
Set drawing values (page size, etc) when drawing a page.
void CalculateTimemap()
Prepare the timemap for MIDI and timemap file export.
void CastOffEncodingDoc()
Cast off of the entire document according to the encoded data (pb and sb).
void ConvertToPageBasedDoc()
Convert the doc from score-based to page-based MEI.
void UpdatePageDrawingSizes()
Update the drawing page sizes when a page is set as drawing page.
bool IsSupportedChild(ClassId classId) override
Add a page to the document.
DocType GetType() const
Getter and setter for the DocType.
Definition: doc.h:131
int GetPageCount() const
Get the total page count.
void ConvertMensuralToCmnDoc()
Convert the doc from mensural to CMN.
void ConvertMarkupDoc(bool permanent=true)
Convert analytical encoding (@fermata, @tie) to correpsonding elements By default,...
int GetAdjustedDrawingPageHeight() const
Return the height adjusted to the content of the current drawing page.
void TransposeDoc()
Transpose the content of the doc.
pugi::xml_document m_header
A copy of the header tree stored as pugi::xml_document.
Definition: doc.h:595
int m_drawingPageMarginLeft
The current page left margin.
Definition: doc.h:623
Score * GetCorrespondingScore(const Object *object)
Get the corresponding score for a node.
int m_drawingPageContentWidth
The current page content width (without margins)
Definition: doc.h:619
void ConvertToCmnDoc()
Convert mensural MEI into CMN measure-based MEI.
void CastOffLineDoc()
Casts off the entire document, using the document's line breaks, but adding its own page breaks.
const Resources & GetResources() const
Getter for the resources.
Definition: doc.h:92
void SyncFromFacsimileDoc()
Sync the coordinate provided trought <facsimile> to m_drawingFacsX/Y.
void ExportMIDI(smf::MidiFile *midiFile)
Export the document to a MIDI file.
void ConvertToCastOffMensuralDoc(bool castOff)
Convert mensural MEI into cast-off (measure) segments looking at the barLine objects.
bool IsCastOff() const
Return true if the document has been cast off already.
Definition: doc.h:518
void ResetToLoading()
Reset to the loading state (unset the scoreDef)
void GenerateFooter()
Generate a document pgFoot if none is provided.
int m_drawingPageWidth
The current page width.
Definition: doc.h:615
std::list< Score * > GetVisibleScores()
Get all visible scores / the first visible score Lazily updates the visible scores,...
void ScoreDefOptimizeDoc()
Optimize the scoreDef once the document is cast-off.
void CastOffDocBase(bool useSb, bool usePb, bool smart=false)
Casts off the entire document, with options for obeying breaks.
void GenerateHeader()
Generate a document pgHead from the MEI header if none is provided.
void ExpandExpansions()
Convert encoded <expansion> before rendering.
bool ExportFeatures(std::string &output, const std::string &options)
Extract music features to JSON string.
void ScoreDefSetGrpSymDoc()
Set the GrpSym start / end for each System once ScoreDef is set and (if necessary) optimized.
int GetAdjustedDrawingPageWidth() const
Return the width adjusted to the content of the current drawing page.
ExpansionMap m_expansionMap
An expansion map that contains
Definition: doc.h:638
void UnCastOffDoc(bool resetCache=true)
Undo the cast off of the entire document.
std::string m_musicDecls
The music@decls value.
Definition: doc.h:610
void ClearSelectionPages()
Clear the selection pages.
data_MEASUREMENTSIGNED GetStaffDistance(const Object *object, int staffIndex, data_STAFFREL staffPosition) const
Get the default distance from the staff for the object The distance is given in x * MEI UNIT.
void PrepareData()
Prepare the document data.
int m_drawingPageMarginRight
The current page right margin.
Definition: doc.h:625
void RefreshLayout()
Refresh the layout of all pages in the doc.
PageRange * m_focusRange
A page range (owned object) with focus in the document.
Definition: doc.h:590
void Reset() override
Clear the content of the document.
bool HasPage(int pageIdx) const
Check if the document has a page with the specified value.
void CastOffDoc()
Casts off the entire document.
bool ExportTimemap(std::string &output, bool includeRests, bool includeMeasures, bool useFractions)
Extract a timemap from the document to a JSON string.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool GenerateMeasureNumbers()
Generate measure numbers from measure attributes.
bool GetMidiExportDone() const
Return true if the MIDI generation is already done.
void ResetToSerialization()
Reset the document for loading a serialization.
void GenerateMEIHeader()
Generate a minimal MEI header.
pugi::xml_document m_back
A copy of the back tree stored as pugi::xml_document.
Definition: doc.h:605
int m_drawingPageContentHeight
The current page content height (without margings)
Definition: doc.h:617
Pages * GetPages()
Get the Pages in the visible Mdiv.
double GetMusicToLyricFontSizeRatio() const
Get the ratio between the lyric font size and the music font size.
data_NOTATIONTYPE m_notationType
Record notation type for document.
Definition: doc.h:635
int m_drawingPageHeight
The current page height.
Definition: doc.h:613
void ScoreDefSetCurrentDoc(bool force=false)
Set the initial scoreDef of each page.
void SyncToFacsimileDoc()
Sync the coordinate provided in rendering to a <facsimile>.
int m_drawingPageMarginBottom
The current page bottom margin.
Definition: doc.h:621
void ConvertHeaderToMEIBasic()
Convert the header to MEI Basic by preserving only the fileDesc and its titleStmt.
void SetFocus()
Reset the document focus.
bool GenerateDocumentScoreDef()
Generate a document scoreDef when none is provided.
bool HasTimemap() const
Check to see if the timemap has already been calculated.
void DeactiveateSelection()
Temporarily deactivate and reactivate selection.
Page * GetDrawingPage()
Getter to the drawPage.
Definition: doc.h:461
ScoreDef * GetFirstScoreDef()
Get the first scoreDef.
bool CheckPageSize(const Page *page) const
Check that the page is the drawing page or that they have no given dimensions.
void SetMarkup(int markup)
Setter for markup flag.
Definition: doc.h:487
Options * GetOptions()
Getter for the options.
Definition: doc.h:83
pugi::xml_document m_front
A copy of the front tree stored as pugi::xml_document.
Definition: doc.h:600
bool ExportExpansionMap(std::string &output)
Extract expansionMap from the document to JSON string.
void CastOffSmartDoc()
Casts off the entire document, only using the document's system breaks if they would be close to the ...
This class stores a document selection.
Definition: docselection.h:24
Definition: expansionmap.h:20
Implements the facsimile element in MEI.
Definition: facsimile.h:31
This class is store font properties.
Definition: devicecontextbase.h:137
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is used for storing a music font glyph.
Definition: glyph.h:31
This class represents a basic object.
Definition: object.h:62
This class contains the document styling parameters.
Definition: options.h:576
This class represents a page in a laid-out score (Doc).
Definition: page.h:31
This class represent a page range not owning child pages.
Definition: pages.h:87
This class represent a <pages> in page-based MEI.
Definition: pages.h:27
Simple class for representing points.
Definition: devicecontextbase.h:203
This class provides resource values.
Definition: resources.h:30
This class represents a MEI scoreDef.
Definition: scoredef.h:135
This class represent a <score> in MEI.
Definition: score.h:30