Verovio
Source code documentation
view.h
1 // Name: view.h
3 // Author: Laurent Pugin
4 // Created: 2010
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_RENDERER_H__
9 #define __VRV_RENDERER_H__
10 
11 #include <optional>
12 
13 #include "devicecontextbase.h"
14 #include "scoredef.h"
15 #include "textelement.h"
16 #include "vrvdef.h"
17 
18 namespace vrv {
19 
20 class Accid;
21 class AnnotScore;
22 class Arpeg;
23 class BarLine;
24 class Beam;
25 class BeamSegment;
26 class BeamSpan;
27 class BracketSpan;
28 class Breath;
29 class Caesura;
30 class Chord;
31 class ControlElement;
32 class DeviceContext;
33 class Dir;
34 class Div;
35 class DivLine;
36 class Doc;
37 class Dynam;
38 class EditorialElement;
39 class Ending;
40 class F;
41 class Fb;
42 class Fig;
43 class Fing;
44 class FloatingCurvePositioner;
45 class Fermata;
46 class Gliss;
47 class Graphic;
48 class Hairpin;
49 class Harm;
50 class KeyAccid;
51 class Layer;
52 class LayerElement;
53 class Lb;
54 class Liquescent;
55 class Measure;
56 class MNum;
57 class Mordent;
58 class Nc;
59 class Neume;
60 class Num;
61 class Octave;
62 class Options;
63 class Ornam;
64 class Ossia;
65 class Page;
66 class PageElement;
67 class Pedal;
68 class PgFoot;
69 class PgHead;
70 class PitchInflection;
71 class Reh;
72 class Rend;
73 class RepeatMark;
74 class RunningElement;
75 class Slur;
76 class Staff;
77 class Svg;
78 class Syl;
79 class Syllable;
80 class Symbol;
81 class SymbolDef;
82 class System;
83 class SystemElement;
84 class Tempo;
85 class Text;
86 class TextDrawingParams;
87 class TextElement;
88 class TextLayoutElement;
89 class Tie;
90 class Trill;
91 class Turn;
92 class Tuplet;
93 class TupletBracket;
94 class TupletNum;
95 class Verse;
96 
97 // Helper enums
98 enum class SlurHandling { Ignore, Initialize, Drawing };
99 
100 //----------------------------------------------------------------------------
101 // View
102 //----------------------------------------------------------------------------
103 
107 class View {
108 public:
111  View();
112  virtual ~View();
114 
119 
124  void SetDoc(Doc *doc);
125 
133  int ToDeviceContextX(int i);
134  int ToLogicalX(int i);
135  int ToDeviceContextY(int i);
136  int ToLogicalY(int i);
137  Point ToDeviceContext(Point p);
138  Point ToLogical(Point p);
140 
147  void SetPage(Page *page, bool doLayout);
148 
157  void DrawCurrentPage(DeviceContext *dc, bool background = true);
158 
162  double GetPPUFactor() const;
163 
169  int CalculatePitchCode(Layer *layer, int y_n, int x_pos, int *octave);
171 
176  SlurHandling GetSlurHandling() const { return m_slurHandling; }
177  void SetSlurHandling(SlurHandling slurHandling) { m_slurHandling = slurHandling; }
179 
180 protected:
187  void DrawPageElement(DeviceContext *dc, PageElement *element);
188  void DrawSystem(DeviceContext *dc, System *system);
189  void DrawSystemList(DeviceContext *dc, System *system, const ClassId classId);
190  void DrawScoreDef(DeviceContext *dc, ScoreDef *scoreDef, Measure *measure, int x, BarLine *barLine = NULL,
191  bool isLastMeasure = false, bool isLastSystem = false, bool noLabels = false);
192  void DrawStaffGrp(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int x, bool topStaffGrp = false,
193  ScoreDefDrawingLabels drawingLabels = DRAWING_LABEL_ABBR);
194  void DrawStaffDef(DeviceContext *dc, Staff *staff, Measure *measure);
195  void DrawStaffDefCautionary(DeviceContext *dc, Staff *staff, Measure *measure);
196  void DrawStaffDefLabels(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int x, bool abbreviations = false);
197  void DrawGrpSym(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int &x);
198  void DrawLabels(DeviceContext *dc, ScoreDef *scoreDef, Object *object, int x, int y, bool abbreviations,
199  int staffSize, int space);
200  void DrawBracket(DeviceContext *dc, int x, int y1, int y2, int staffSize);
201  void DrawBracketSq(DeviceContext *dc, int x, int y1, int y2, int staffSize);
202  void DrawBrace(DeviceContext *dc, int x, int y1, int y2, int staffSize);
203  void DrawBarLines(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, BarLine *barLine, bool isLastMeasure,
204  bool isLastSystem, int &yBottomPrevious);
205  void DrawBarLine(DeviceContext *dc, int yTop, int yBottom, BarLine *barLine, data_BARRENDITION form,
206  bool inStaffSpace = false, bool eraseIntersections = false);
207  void DrawBarLineDots(DeviceContext *dc, Staff *staff, BarLine *barLine);
208  void DrawLedgerLines(DeviceContext *dc, Staff *staff, const ArrayOfLedgerLines &lines, bool below, bool cueSize);
209  void DrawMeasure(DeviceContext *dc, Measure *measure, System *system);
210  void DrawMeterSigGrp(DeviceContext *dc, Layer *layer, Staff *staff);
211  void DrawMNum(DeviceContext *dc, MNum *mnum, Measure *measure, System *system, int yOffset);
212  void DrawOssia(DeviceContext *dc, Ossia *ossia, Measure *measure, System *system);
213  void DrawStaff(DeviceContext *dc, Staff *staff, Measure *measure, System *system);
214  void DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, Measure *measure, System *system);
215  void DrawLayer(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure);
216  void DrawLayerList(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure, const ClassId classId);
217  void DrawLayerDefLabels(
218  DeviceContext *dc, ScoreDef *scoreDef, Staff *staff, StaffDef *staffDef, int x, bool abbreviations = false);
219  void DrawSystemDivider(DeviceContext *dc, System *system, Measure *firstMeasure);
221 
227  void DrawDiv(DeviceContext *dc, Div *div, System *system);
228  void DrawRunningElements(DeviceContext *dc, Page *page);
229  void DrawTextLayoutElement(DeviceContext *dc, TextLayoutElement *textLayoutElement);
231 
241  void DrawSystemChildren(DeviceContext *dc, Object *parent, System *system);
242  void DrawMeasureChildren(DeviceContext *dc, Object *parent, Measure *measure, System *system);
243  void DrawStaffChildren(DeviceContext *dc, Object *parent, Staff *staff, Measure *measure);
244  void DrawLayerChildren(DeviceContext *dc, Object *parent, Layer *layer, Staff *staff, Measure *measure);
245  void DrawTextChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
246  void DrawFbChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
247  void DrawRunningChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
249 
255  void DrawSystemEditorialElement(DeviceContext *dc, EditorialElement *element, System *system);
256  void DrawMeasureEditorialElement(DeviceContext *dc, EditorialElement *element, Measure *measure, System *system);
257  void DrawStaffEditorialElement(DeviceContext *dc, EditorialElement *element, Staff *staff, Measure *measure);
258  void DrawLayerEditorialElement(
259  DeviceContext *dc, EditorialElement *element, Layer *layer, Staff *staff, Measure *measure);
260  void DrawTextEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
261  void DrawFbEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
262  void DrawRunningEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
264 
270  void DrawAnnot(DeviceContext *dc, EditorialElement *element, bool isTextElement = false);
272 
280  void DrawLayerElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
282 
291  void DrawAccid(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
292  void DrawArtic(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
293  void DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
294  void DrawBeatRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
295  void DrawBTrem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
296  void DrawChord(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
297  void DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
298  void DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
299  void DrawDot(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
300  void DrawDots(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
301  void DrawDurationElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
302  void DrawFlag(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
303  void DrawGenericLayerElement(
304  DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
305  void DrawGraceGrp(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
306  void DrawHalfmRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
307  void DrawKeySig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
308  void DrawLigature(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
309  void DrawMeterSig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
310  void DrawMRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
311  void DrawMRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
312  void DrawMRpt2(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
313  void DrawMSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
314  void DrawMultiRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
315  void DrawMultiRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
316  void DrawNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
317  void DrawRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
318  void DrawSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
319  void DrawStem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
320  void DrawStemMod(DeviceContext *dc, LayerElement *element, Staff *staff);
321  void DrawSyl(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
322  void DrawTuplet(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
323  void DrawVerse(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
325 
333  void DrawAcciaccaturaSlash(DeviceContext *dc, Stem *stem, Staff *staff);
334  void DrawChordCluster(DeviceContext *dc, Chord *chord, Layer *layer, Staff *staff, Measure *measure);
335  void DrawClefEnclosing(DeviceContext *dc, Clef *clef, Staff *staff, char32_t glyph, int x, int y);
336  void DrawDotsPart(DeviceContext *dc, int x, int y, unsigned char dots, const Staff *staff, bool dimin = false);
337  void DrawKeySigCancellation(
338  DeviceContext *dc, KeySig *keySig, Staff *staff, Clef *clef, int clefLocOffset, int beginCancel, int &x);
339  void DrawKeyAccid(DeviceContext *dc, KeyAccid *keyAccid, Staff *staff, Clef *clef, int clefLocOffset, int &x);
340  void DrawMeterSig(DeviceContext *dc, MeterSig *meterSig, Staff *staff, int horizOffset);
342  int DrawMeterSigFigures(DeviceContext *dc, int x, int y, MeterSig *meterSig, int den, Staff *staff);
343  void DrawMRptPart(DeviceContext *dc, int xCentered, int y, char32_t smulfCode, int num, bool line, Staff *staff);
345 
352  void DrawTextElement(DeviceContext *dc, TextElement *element, TextDrawingParams &params);
354 
360  void DrawFb(DeviceContext *dc, Staff *staff, Fb *element, TextDrawingParams &params);
361  void DrawF(DeviceContext *dc, F *figure, TextDrawingParams &params);
362 
364 
373  void DrawFig(DeviceContext *dc, Fig *fig, TextDrawingParams &params);
374  void DrawLb(DeviceContext *dc, Lb *lb, TextDrawingParams &params);
375  void DrawNum(DeviceContext *dc, Num *num, TextDrawingParams &params);
376  void DrawRend(DeviceContext *dc, Rend *rend, TextDrawingParams &params);
377  void DrawGraphic(DeviceContext *dc, Graphic *graphic, TextDrawingParams &params, int staffSize, bool dimin);
378  void DrawSvg(DeviceContext *dc, Svg *svg, TextDrawingParams &params, int staffSize, bool dimin);
379  void DrawSymbol(DeviceContext *dc, Symbol *symbol, TextDrawingParams &params);
380  void DrawText(DeviceContext *dc, Text *text, TextDrawingParams &params);
381  void DrawTextEnclosure(DeviceContext *dc, const TextDrawingParams &params, int staffSize);
382 
388  void DrawBeam(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
389  void DrawFTrem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
390  void DrawBeamSpan(DeviceContext *dc, BeamSpan *beamSpan, System *system, Object *graphic = NULL);
392 
398  void DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
399  void DrawSyllable(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
400  void DrawLiquescent(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
401  void DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
402  void DrawNeume(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
403  void DrawOriscus(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
404  void DrawQuilisma(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
406 
412  void DrawNcAsNotehead(DeviceContext *dc, Nc *nc, Layer *layer, Staff *staff, Measure *measure);
413  void DrawNcGlyphs(DeviceContext *dc, Nc *nc, Staff *staff);
415 
423  void DrawControlElement(DeviceContext *dc, ControlElement *element, Measure *measure, System *system);
424  void DrawTimeSpanningElement(DeviceContext *dc, Object *element, System *system);
425  void DrawArpeg(DeviceContext *dc, Arpeg *arpeg, Measure *measure, System *system);
426  void DrawArpegEnclosing(DeviceContext *dc, Arpeg *arpeg, Staff *staff, char32_t startGlyph, char32_t fillGlyph,
427  char32_t endGlyph, int x, int y, int height, bool cueSize);
428  void DrawBreath(DeviceContext *dc, Breath *breath, Measure *measure, System *system);
429  void DrawCaesura(DeviceContext *dc, Caesura *caesura, Measure *measure, System *system);
430  void DrawControlElementText(DeviceContext *dc, ControlElement *element, Measure *measure, System *system);
431  void DrawDynam(DeviceContext *dc, Dynam *dynam, Measure *measure, System *system);
432  void DrawDynamSymbolOnly(DeviceContext *dc, Staff *staff, Dynam *dynam, const std::u32string &dynamSymbol,
433  data_HORIZONTALALIGNMENT alignment, TextDrawingParams &params);
434  void DrawFermata(DeviceContext *dc, Fermata *fermata, Measure *measure, System *system);
435  void DrawFing(DeviceContext *dc, Fing *fing, Measure *measure, System *system);
436  void DrawHarm(DeviceContext *dc, Harm *harm, Measure *measure, System *system);
437  void DrawMordent(DeviceContext *dc, Mordent *mordent, Measure *measure, System *system);
438  void DrawPedal(DeviceContext *dc, Pedal *pedal, Measure *measure, System *system);
439  void DrawReh(DeviceContext *dc, Reh *reh, Measure *measure, System *system);
440  void DrawRepeatMark(DeviceContext *dc, RepeatMark *repeatMark, Measure *measure, System *system);
441  void DrawTempo(DeviceContext *dc, Tempo *tempo, Measure *measure, System *system);
442  void DrawTrill(DeviceContext *dc, Trill *trill, Measure *measure, System *system);
443  void DrawTurn(DeviceContext *dc, Turn *turn, Measure *measure, System *system);
445 
451  void DrawControlElementConnector(DeviceContext *dc, ControlElement *element, int x1, int x2, Staff *staff,
452  char spanningType, Object *graphic = NULL);
453  void DrawAnnotScore(DeviceContext *dc, AnnotScore *annotScore, int x1, int x2, Staff *staff, char spanningType,
454  Object *graphic = NULL);
455  void DrawBracketSpan(DeviceContext *dc, BracketSpan *bracketSpan, int x1, int x2, Staff *staff, char spanningType,
456  Object *graphic = NULL);
457  void DrawFConnector(
458  DeviceContext *dc, F *f, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
459  void DrawGliss(
460  DeviceContext *dc, Gliss *gliss, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
461  void DrawHairpin(
462  DeviceContext *dc, Hairpin *hairpin, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
463  void DrawOctave(
464  DeviceContext *dc, Octave *octave, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
465  void DrawPedalLine(
466  DeviceContext *dc, Pedal *pedal, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
467  void DrawPitchInflection(DeviceContext *dc, PitchInflection *pitchInflection, int x1, int x2, Staff *staff,
468  char spanningType, Object *graphic = NULL);
469  void DrawSlur(
470  DeviceContext *dc, Slur *slur, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
471  void DrawTie(DeviceContext *dc, Tie *tie, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
472  void DrawTrillExtension(
473  DeviceContext *dc, Trill *trill, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
474  void DrawSylConnector(
475  DeviceContext *dc, Syl *syl, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
477 
482  void DrawSylConnectorLines(DeviceContext *dc, int x1, int x2, int y, Syl *syl, Staff *staff);
484 
491  void DrawSystemElement(DeviceContext *dc, SystemElement *element, System *system);
492  void DrawEnding(DeviceContext *dc, Ending *ending, System *system);
494 
503  void DrawMensur(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
504  void DrawMensuralNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
505  void DrawDotInLigature(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
506  void DrawPlica(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
507  void DrawProport(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
509 
515  void DrawMensuralStem(DeviceContext *dc, Note *note, Staff *staff, data_STEMDIRECTION dir, int xn, int originY);
516  void DrawMaximaToBrevis(DeviceContext *dc, int y, LayerElement *element, Layer *layer, Staff *staff);
517  void DrawProportFigures(DeviceContext *dc, int x, int y, int num, int numBase, Staff *staff);
518  void DrawLigatureNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff);
520 
529  void DrawTabClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
530  void DrawTabDurSym(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
531  void DrawTabGrp(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
532  void DrawTabNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
534 
540  void DrawTupletBracket(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
541  void DrawTupletNum(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
542 
548  void DrawVerticalLine(DeviceContext *dc, int y1, int y2, int x1, int width, int dashLength = 0, int gapLength = 0);
549  void DrawHorizontalLine(
550  DeviceContext *dc, int x1, int x2, int y1, int width, int dashLength = 0, int gapLength = 0);
551  void DrawObliqueLine(
552  DeviceContext *dc, int x1, int x2, int y1, int y2, int width, int dashLength = 0, int gapLength = 0);
553  void DrawVerticalSegmentedLine(
554  DeviceContext *dc, int x1, SegmentedLine &line, int width, int dashLength = 0, int gapLength = 0);
555  void DrawHorizontalSegmentedLine(
556  DeviceContext *dc, int y1, SegmentedLine &line, int width, int dashLength = 0, int gapLength = 0);
557  void DrawSmuflCode(
558  DeviceContext *dc, int x, int y, char32_t code, int staffSize, bool dimin, bool setBBGlyph = false);
559  // void DrawSmuflCodeWithCustomFont(DeviceContext *dc, const std::string &customFont, int x, int y, char32_t code,
560  // int staffSize, bool dimin, bool setBBGlyph = false);
561 
562  void DrawThickBezierCurve(
563  DeviceContext *dc, Point bezier[4], int thickness, int staffSize, int penWidth, PenStyle penStyle = PEN_SOLID);
564  void DrawTextString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
565  void DrawDirString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
566  void DrawDynamString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params, Rend *rend);
567  void DrawHarmString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
568  void DrawSmuflLine(DeviceContext *dc, Point orig, int length, int staffSize, bool dimin, char32_t fill,
569  char32_t start = 0, char32_t end = 0);
570  void DrawSmuflString(DeviceContext *dc, int x, int y, std::u32string s, data_HORIZONTALALIGNMENT alignment,
571  int staffSize = 100, bool dimin = false, bool setBBGlyph = false);
572  void DrawLyricString(DeviceContext *dc, const std::u32string &str, int staffSize = 100,
573  std::optional<TextDrawingParams> params = std::nullopt);
574  void DrawNotFilledEllipse(DeviceContext *dc, int x1, int y1, int x2, int y2, int lineThinkness);
575  void DrawFilledRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2);
576  void DrawNotFilledRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2, int lineThinkness, int radius);
577  void DrawFilledRoundedRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2, int radius);
578  void DrawObliquePolygon(DeviceContext *dc, int x1, int y1, int x2, int y2, int height);
579  void DrawDiamond(DeviceContext *dc, int x1, int y1, int height, int width, bool fill, int linewidth);
580  void DrawDot(DeviceContext *dc, int x, int y, int staffSize, bool dimin = false);
581  void DrawSquareBracket(DeviceContext *dc, bool leftBracket, int x, int y, int height, int width,
582  int horizontalThickness, int verticalThickness);
583  void DrawEnclosingBrackets(DeviceContext *dc, int x, int y, int height, int width, int offset, int bracketWidth,
584  int horizontalThickness, int verticalThickness);
585  void DrawVerticalDots(DeviceContext *dc, int x, const SegmentedLine &line, int barlineWidth, int interval);
586  void DrawSymbolDef(DeviceContext *dc, Object *parent, SymbolDef *symbolDef, int x, int y, int staffSize, bool dimin,
587  data_HORIZONTALALIGNMENT alignement = HORIZONTALALIGNMENT_left);
589 
596 
597 private:
602  data_STEMDIRECTION GetTupletCoordinates(Tuplet *tuplet, Layer *layer, Point *start, Point *end, Point *center);
603  std::u32string IntToTupletFigures(unsigned short number);
604  std::u32string IntToTimeSigFigures(unsigned short number);
605  std::u32string IntToSmuflFigures(unsigned short number, int offset);
606  int NestedTuplets(Object *object);
607  int GetSylYRel(int verseN, Staff *staff, data_STAFFREL place);
608  int GetFYRel(F *f, Staff *staff);
610 
615  FloatingCurvePositioner *CalcInitialSlur(
616  DeviceContext *dc, Slur *slur, int x1, int x2, Staff *staff, char spanningType);
618 
622  void CalcBrevisPoints(
623  Note *note, Staff *staff, Point *topLeft, Point *bottomRight, int sides[4], int shape, bool isMensuralBlack);
624  void CalcObliquePoints(Note *note1, Note *note2, Staff *staff, Point points[4], int sides[4], int shape,
625  bool isMensuralBlack, bool firstHalf, bool straight);
626 
631  void DrawBeamSegment(
632  DeviceContext *dc, BeamSegment *segment, BeamDrawingInterface *beamInterface, Layer *layer, Staff *staff);
633  void DrawFTremSegment(DeviceContext *dc, Staff *staff, FTrem *fTrem);
635 
639  bool HasValidTimeSpanningOrder(DeviceContext *dc, Object *element, LayerElement *start, LayerElement *end) const;
640 
644  data_STEMDIRECTION GetMensuralStemDir(Layer *layer, Note *note, int verticalCenter);
645 
652  void StartOffset(DeviceContext *dc, const Object *object, int staffSize);
653  void EndOffset(DeviceContext *dc, const Object *object);
654  void SetOffsetStaffSize(const Object *object, int staffSize);
656 
662  void CalcOffset(DeviceContext *dc, int &x, int &y);
663  void CalcOffsetX(DeviceContext *dc, int &x);
664  void CalcOffsetY(DeviceContext *dc, int &y);
665  void CalcOffsetSpanningStartX(DeviceContext *dc, int &x, char spanningType, double factor = 1.0);
666  void CalcOffsetSpanningEndX(DeviceContext *dc, int &x, char spanningType, double factor = 1.0);
667  void CalcOffsetSpanningStartY(DeviceContext *dc, int &y, char spanningType, double factor = 1.0);
668  void CalcOffsetSpanningEndY(DeviceContext *dc, int &y, char spanningType, double factor = 1.0);
669  void CalcOffsetBezier(DeviceContext *dc, Point points[4], char spanningType);
671 
675  class Offset {
676  public:
677  int m_ho = 0;
678  int m_vo = 0;
679  int m_startho = 0;
680  int m_startvo = 0;
681  int m_endho = 0;
682  int m_endvo = 0;
683  const Object *m_object = NULL;
684  int m_staffSize = 100;
685  };
686 
687 public:
692 
699  Page *m_currentPage;
701 
702 protected:
708 
712  SlurHandling m_slurHandling;
713 
720 
721 private:
722  //----------------//
723  // Static members //
724  //----------------//
725 
728  static thread_local int s_drawingLigX[2], s_drawingLigY[2];
729  static thread_local bool s_drawingLigObliqua;
731 
733  std::list<Offset> m_currentOffsets;
734 };
735 
736 } // namespace vrv
737 
738 #endif
This class models the MEI <annot> element where @type is score.
Definition: annotscore.h:24
This class models the MEI <arpeg> element.
Definition: arpeg.h:31
This class is an interface for MEI beam elements (beam, beamSpan).
Definition: drawinginterface.h:98
Class for storing drawing parameters when calculating beams.
Definition: beam.h:36
This class models the MEI <beamSpan> element.
Definition: beamspan.h:36
This class models the MEI <bracketSpan> element.
Definition: bracketspan.h:28
This class models the MEI <breath> element.
Definition: breath.h:24
This class models the MEI <caesura> element.
Definition: caesura.h:29
This class represents elements appearing within a measure.
Definition: controlelement.h:35
This class is an abstract device context.
Definition: devicecontext.h:57
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
Definition: dynam.h:33
This class represents a MEI ending.
Definition: ending.h:33
This class models the MEI <f> element.
Definition: f.h:24
This class models the MEI <fTrem> element.
Definition: ftrem.h:25
This class models the MEI <fb> element.
Definition: fb.h:23
This class models the MEI <fermata> element.
Definition: fermata.h:32
This class models the MEI <fig> element.
Definition: fig.h:23
This class models the MEI <fing> element.
Definition: fing.h:25
This class represents a basic object for a curve (slur, tie) in the layout domain.
Definition: floatingobject.h:329
This class models the MEI <gliss> element.
Definition: gliss.h:28
Implements the graphic element in MEI.
Definition: graphic.h:30
This class models the MEI <hairpin> element.
Definition: hairpin.h:32
This class models the MEI <harm> element.
Definition: harm.h:32
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a layer in a laid-out score (Doc).
Definition: layer.h:39
This class models the MEI <lb>
Definition: lb.h:23
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class models the MEI <meterSig> element.
Definition: metersig.h:34
This class models the MEI <mordent> element.
Definition: mordent.h:33
This class models the MEI <nc> element.
Definition: nc.h:43
This class models the MEI <note> element.
Definition: note.h:69
This class models the MEI <num> element.
Definition: num.h:24
This class represents a basic object.
Definition: object.h:64
This class models the MEI <octave> element.
Definition: octave.h:31
This class contains the document styling parameters.
Definition: options.h:577
This class represents a page in a laid-out score (Doc).
Definition: page.h:31
This class models the MEI <pedal> element.
Definition: pedal.h:34
This class models the MEI <dir> element.
Definition: pitchinflection.h:23
Simple class for representing points.
Definition: devicecontextbase.h:203
This class models the MEI <reh> element.
Definition: reh.h:30
This class models the MEI <rend> element.
Definition: rend.h:33
This class models the MEI <ornam> element.
Definition: repeatmark.h:32
This class represents a MEI scoreDef.
Definition: scoredef.h:135
Definition: boundingbox.h:337
Definition: slur.h:59
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:110
Definition: svg.h:20
Syl is a TimeSpanningInterface for managing syllable connectors.
Definition: syl.h:38
Definition: symboldef.h:20
This class models the MEI <symbol> element.
Definition: symbol.h:25
This class represents elements appearing within a measure.
Definition: systemelement.h:26
This class represents a system in a laid-out score (Doc).
Definition: system.h:36
This class is an interface for <tempo> elements at the measure level.
Definition: tempo.h:33
This class stores current drawing parameters for text.
Definition: textelement.h:90
Definition: textelement.h:22
This class models CDATA (text)
Definition: text.h:23
This class models the MEI <tie> element.
Definition: tie.h:32
This class models the MEI <trill> element.
Definition: trill.h:35
Definition: tuplet.h:33
This class models the MEI <turn> element.
Definition: turn.h:33
This class is a drawing context and corresponds to the view of a MVC design pattern.
Definition: view.h:107
void DrawCurrentPage(DeviceContext *dc, bool background=true)
Method that actually draw the current page.
void SetPage(Page *page, bool doLayout)
Set the current page.
void SetScoreDefDrawingWidth(DeviceContext *dc, ScoreDef *scoreDef)
Calculate the ScoreDef width by taking into account its widest key signature.
int m_currentColor
The color currently being used when drawing.
Definition: view.h:707
Options * m_options
Options of the document.
Definition: view.h:691
View()
Constructors and destructors.
void SetDoc(Doc *doc)
Set the document the view is pointing to (mandatory).
Doc * m_doc
Document.
Definition: view.h:689
ScoreDef m_drawingScoreDef
The current drawing score def.
Definition: view.h:719
SlurHandling GetSlurHandling() const
Control how slurs are handled.
Definition: view.h:176
int DrawMeterSigFigures(DeviceContext *dc, int x, int y, MeterSig *meterSig, int den, Staff *staff)
Returns the width of the drawn figures.
double GetPPUFactor() const
Return the pixel per unit factor of the current page (if any, 1.0 otherwise)
SlurHandling m_slurHandling
Control the handling of slurs.
Definition: view.h:712
bool GetNotationMode()
Simply returns the value of the last note-type element (mensural or neume)