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 Refrain;
73 class Rend;
74 class RepeatMark;
75 class RunningElement;
76 class Slur;
77 class Staff;
78 class Svg;
79 class Syl;
80 class Syllable;
81 class Symbol;
82 class SymbolDef;
83 class System;
84 class SystemElement;
85 class Tempo;
86 class Text;
87 class TextDrawingParams;
88 class TextElement;
89 class TextLayoutElement;
90 class Tie;
91 class Trill;
92 class Turn;
93 class Tuplet;
94 class TupletBracket;
95 class TupletNum;
96 class Volta;
97 class Verse;
98 
99 // Helper enums
100 enum class SlurHandling { Ignore, Initialize, Drawing };
101 
102 //----------------------------------------------------------------------------
103 // View
104 //----------------------------------------------------------------------------
105 
109 class View {
110 public:
113  View();
114  virtual ~View();
116 
121 
126  void SetDoc(Doc *doc);
127 
135  int ToDeviceContextX(int i);
136  int ToLogicalX(int i);
137  int ToDeviceContextY(int i);
138  int ToLogicalY(int i);
139  Point ToDeviceContext(Point p);
140  Point ToLogical(Point p);
142 
149  void SetPage(Page *page, bool doLayout);
150 
159  void DrawCurrentPage(DeviceContext *dc, bool background = true);
160 
164  double GetPPUFactor() const;
165 
171  int CalculatePitchCode(Layer *layer, int y_n, int x_pos, int *octave);
173 
178  SlurHandling GetSlurHandling() const { return m_slurHandling; }
179  void SetSlurHandling(SlurHandling slurHandling) { m_slurHandling = slurHandling; }
181 
182 protected:
189  void DrawPageElement(DeviceContext *dc, PageElement *element);
190  void DrawSystem(DeviceContext *dc, System *system);
191  void DrawSystemList(DeviceContext *dc, System *system, const ClassId classId);
192  void DrawScoreDef(DeviceContext *dc, ScoreDef *scoreDef, Measure *measure, int x, BarLine *barLine = NULL,
193  bool isLastMeasure = false, bool isLastSystem = false, bool noLabels = false);
194  void DrawStaffGrp(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int x, bool topStaffGrp = false,
195  ScoreDefDrawingLabels drawingLabels = DRAWING_LABEL_ABBR);
196  void DrawStaffDef(DeviceContext *dc, Staff *staff, Measure *measure);
197  void DrawStaffDefCautionary(DeviceContext *dc, Staff *staff, Measure *measure);
198  void DrawStaffDefLabels(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int x, bool abbreviations = false);
199  void DrawGrpSym(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, int &x);
200  void DrawLabels(DeviceContext *dc, ScoreDef *scoreDef, Object *object, int x, int y, bool abbreviations,
201  int staffSize, int space);
202  void DrawBracket(DeviceContext *dc, int x, int y1, int y2, int staffSize);
203  void DrawBracketSq(DeviceContext *dc, int x, int y1, int y2, int staffSize);
204  void DrawBrace(DeviceContext *dc, int x, int y1, int y2, int staffSize, bool forceGlyph = false);
205  void DrawBarLines(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, BarLine *barLine, bool isLastMeasure,
206  bool isLastSystem, int &yBottomPrevious);
207  void DrawBarLine(DeviceContext *dc, int yTop, int yBottom, BarLine *barLine, data_BARRENDITION form,
208  bool inStaffSpace = false, bool eraseIntersections = false);
209  void DrawBarLineDots(DeviceContext *dc, Staff *staff, BarLine *barLine);
210  void DrawLedgerLines(DeviceContext *dc, Staff *staff, const ArrayOfLedgerLines &lines, bool below, bool cueSize);
211  void DrawMeasure(DeviceContext *dc, Measure *measure, System *system);
212  void DrawMeterSigGrp(DeviceContext *dc, Layer *layer, Staff *staff);
213  void DrawMNum(DeviceContext *dc, MNum *mnum, Measure *measure, System *system, int yOffset);
214  void DrawOssia(DeviceContext *dc, Ossia *ossia, Measure *measure, System *system);
215  void DrawStaff(DeviceContext *dc, Staff *staff, Measure *measure, System *system);
216  void DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, Measure *measure, System *system);
217  void DrawLayer(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure);
218  void DrawCursor(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
219  void DrawLayerList(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure, const ClassId classId);
220  void DrawLayerDefLabels(
221  DeviceContext *dc, ScoreDef *scoreDef, Staff *staff, StaffDef *staffDef, int x, bool abbreviations = false);
222  void DrawSystemDivider(DeviceContext *dc, System *system, Measure *firstMeasure);
223  void DrawPlaceholder(DeviceContext *dc, Object *object, System *system);
225 
231  void DrawDiv(DeviceContext *dc, Div *div, System *system);
232  void DrawRunningElements(DeviceContext *dc, Page *page);
233  void DrawTextLayoutElement(DeviceContext *dc, TextLayoutElement *textLayoutElement);
235 
245  void DrawSystemChildren(DeviceContext *dc, Object *parent, System *system);
246  void DrawMeasureChildren(DeviceContext *dc, Object *parent, Measure *measure, System *system);
247  void DrawStaffChildren(DeviceContext *dc, Object *parent, Staff *staff, Measure *measure);
248  void DrawLayerChildren(DeviceContext *dc, Object *parent, Layer *layer, Staff *staff, Measure *measure);
249  void DrawTextChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
250  void DrawFbChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
251  void DrawRunningChildren(DeviceContext *dc, Object *parent, TextDrawingParams &params);
253 
259  void DrawSystemEditorialElement(DeviceContext *dc, EditorialElement *element, System *system);
260  void DrawMeasureEditorialElement(DeviceContext *dc, EditorialElement *element, Measure *measure, System *system);
261  void DrawStaffEditorialElement(DeviceContext *dc, EditorialElement *element, Staff *staff, Measure *measure);
262  void DrawLayerEditorialElement(
263  DeviceContext *dc, EditorialElement *element, Layer *layer, Staff *staff, Measure *measure);
264  void DrawTextEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
265  void DrawFbEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
266  void DrawRunningEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams &params);
268 
274  void DrawAnnot(DeviceContext *dc, EditorialElement *element, bool isTextElement = false);
276 
284  void DrawLayerElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
286 
295  void DrawAccid(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
296  void DrawArtic(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
297  void DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
298  void DrawBeatRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
299  void DrawBTrem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
300  void DrawChord(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
301  void DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
302  void DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
303  void DrawDot(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
304  void DrawDots(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
305  void DrawDurationElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
306  void DrawFlag(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
307  void DrawGenericLayerElement(
308  DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
309  void DrawGraceGrp(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
310  void DrawHalfmRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
311  void DrawKeySig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
312  void DrawLigature(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
313  void DrawMeterSig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
314  void DrawMRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
315  void DrawMRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
316  void DrawMRpt2(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
317  void DrawMSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
318  void DrawMultiRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
319  void DrawMultiRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
320  void DrawNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
321  void DrawRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
322  void DrawSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
323  void DrawStem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
324  void DrawStemMod(DeviceContext *dc, LayerElement *element, Staff *staff);
325  void DrawSyl(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
326  void DrawTuplet(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
327  void DrawVolta(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
328  void DrawLyricElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
330 
338  void DrawAcciaccaturaSlash(DeviceContext *dc, Stem *stem, Staff *staff);
339  void DrawChordCluster(DeviceContext *dc, Chord *chord, Layer *layer, Staff *staff, Measure *measure);
340  void DrawClefEnclosing(DeviceContext *dc, Clef *clef, Staff *staff, char32_t glyph, int x, int y);
341  void DrawDotsPart(DeviceContext *dc, int x, int y, unsigned char dots, const Staff *staff, bool dimin = false);
342  void DrawKeySigCancellation(
343  DeviceContext *dc, KeySig *keySig, Staff *staff, Clef *clef, int clefLocOffset, int beginCancel, int &x);
344  void DrawKeyAccid(DeviceContext *dc, KeyAccid *keyAccid, Staff *staff, Clef *clef, int clefLocOffset, int &x);
345  void DrawMeterSig(DeviceContext *dc, MeterSig *meterSig, Staff *staff, int horizOffset);
347  int DrawMeterSigFigures(DeviceContext *dc, int x, int y, MeterSig *meterSig, int den, Staff *staff);
348  void DrawMRptPart(DeviceContext *dc, int xCentered, int y, char32_t smulfCode, int num, bool line, Staff *staff);
350 
357  void DrawTextElement(DeviceContext *dc, TextElement *element, TextDrawingParams &params);
359 
365  void DrawFb(DeviceContext *dc, Staff *staff, Fb *element, TextDrawingParams &params);
366  void DrawF(DeviceContext *dc, F *figure, TextDrawingParams &params);
367 
369 
378  void DrawFig(DeviceContext *dc, Fig *fig, TextDrawingParams &params);
379  void DrawLb(DeviceContext *dc, Lb *lb, TextDrawingParams &params);
380  void DrawNum(DeviceContext *dc, Num *num, TextDrawingParams &params);
381  void DrawRend(DeviceContext *dc, Rend *rend, TextDrawingParams &params);
382  void DrawGraphic(DeviceContext *dc, Graphic *graphic, TextDrawingParams &params, int staffSize, bool dimin);
383  void DrawSvg(DeviceContext *dc, Svg *svg, TextDrawingParams &params, int staffSize, bool dimin);
384  void DrawSymbol(DeviceContext *dc, Symbol *symbol, TextDrawingParams &params);
385  void DrawText(DeviceContext *dc, Text *text, TextDrawingParams &params);
386  void DrawTextEnclosure(DeviceContext *dc, const TextDrawingParams &params, int staffSize);
387 
393  void DrawBeam(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
394  void DrawFTrem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
395  void DrawBeamSpan(DeviceContext *dc, BeamSpan *beamSpan, System *system, Object *graphic = NULL);
397 
403  void DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
404  void DrawEpisema(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
405  void DrawSyllable(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
406  void DrawLiquescent(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
407  void DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
408  void DrawNeume(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
409  void DrawOriscus(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
410  void DrawQuilisma(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
411  void DrawStrophicus(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
413 
419  void DrawNcAsNotehead(DeviceContext *dc, Nc *nc, Layer *layer, Staff *staff, Measure *measure);
420  void DrawNcGlyphs(DeviceContext *dc, Nc *nc, Staff *staff);
422 
430  void DrawControlElement(DeviceContext *dc, ControlElement *element, Measure *measure, System *system);
431  void DrawTimeSpanningElement(DeviceContext *dc, Object *element, System *system);
432  void DrawArpeg(DeviceContext *dc, Arpeg *arpeg, Measure *measure, System *system);
433  void DrawArpegEnclosing(DeviceContext *dc, Arpeg *arpeg, Staff *staff, char32_t startGlyph, char32_t fillGlyph,
434  char32_t endGlyph, int x, int y, int height, bool cueSize);
435  void DrawBreath(DeviceContext *dc, Breath *breath, Measure *measure, System *system);
436  void DrawCaesura(DeviceContext *dc, Caesura *caesura, Measure *measure, System *system);
437  void DrawControlElementText(DeviceContext *dc, ControlElement *element, Measure *measure, System *system);
438  void DrawDynam(DeviceContext *dc, Dynam *dynam, Measure *measure, System *system);
439  void DrawDynamSymbolOnly(DeviceContext *dc, Staff *staff, Dynam *dynam, const std::u32string &dynamSymbol,
440  data_HORIZONTALALIGNMENT alignment, TextDrawingParams &params);
441  void DrawFermata(DeviceContext *dc, Fermata *fermata, Measure *measure, System *system);
442  void DrawFing(DeviceContext *dc, Fing *fing, Measure *measure, System *system);
443  void DrawHarm(DeviceContext *dc, Harm *harm, Measure *measure, System *system);
444  void DrawMordent(DeviceContext *dc, Mordent *mordent, Measure *measure, System *system);
445  void DrawPedal(DeviceContext *dc, Pedal *pedal, Measure *measure, System *system);
446  void DrawReh(DeviceContext *dc, Reh *reh, Measure *measure, System *system);
447  void DrawRepeatMark(DeviceContext *dc, RepeatMark *repeatMark, Measure *measure, System *system);
448  void DrawTempo(DeviceContext *dc, Tempo *tempo, Measure *measure, System *system);
449  void DrawTrill(DeviceContext *dc, Trill *trill, Measure *measure, System *system);
450  void DrawTurn(DeviceContext *dc, Turn *turn, Measure *measure, System *system);
452 
458  void DrawControlElementConnector(DeviceContext *dc, ControlElement *element, int x1, int x2, Staff *staff,
459  char spanningType, Object *graphic = NULL);
460  void DrawAnnotScore(DeviceContext *dc, AnnotScore *annotScore, int x1, int x2, Staff *staff, char spanningType,
461  Object *graphic = NULL);
462  void DrawBracketSpan(DeviceContext *dc, BracketSpan *bracketSpan, int x1, int x2, Staff *staff, char spanningType,
463  Object *graphic = NULL);
464  void DrawFConnector(
465  DeviceContext *dc, F *f, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
466  void DrawGliss(
467  DeviceContext *dc, Gliss *gliss, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
468  void DrawHairpin(
469  DeviceContext *dc, Hairpin *hairpin, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
470  void DrawOctave(
471  DeviceContext *dc, Octave *octave, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
472  void DrawPedalLine(
473  DeviceContext *dc, Pedal *pedal, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
474  void DrawPitchInflection(DeviceContext *dc, PitchInflection *pitchInflection, int x1, int x2, Staff *staff,
475  char spanningType, Object *graphic = NULL);
476  void DrawSlur(
477  DeviceContext *dc, Slur *slur, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
478  void DrawTie(DeviceContext *dc, Tie *tie, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
479  void DrawTrillExtension(
480  DeviceContext *dc, Trill *trill, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
481  void DrawSylConnector(
482  DeviceContext *dc, Syl *syl, int x1, int x2, Staff *staff, char spanningType, Object *graphic = NULL);
484 
489  void DrawSylConnectorLines(DeviceContext *dc, int x1, int x2, int y, Syl *syl, Staff *staff);
491 
498  void DrawSystemElement(DeviceContext *dc, SystemElement *element, System *system);
499  void DrawEnding(DeviceContext *dc, Ending *ending, System *system);
501 
510  void DrawMensur(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
511  void DrawMensuralNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
512  void DrawDotInLigature(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
513  void DrawPlica(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
514  void DrawProport(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
516 
522  void DrawMensuralStem(DeviceContext *dc, Note *note, Staff *staff, data_STEMDIRECTION dir, int xn, int originY);
523  void DrawMaximaToBrevis(DeviceContext *dc, int y, LayerElement *element, Layer *layer, Staff *staff);
524  void DrawProportFigures(DeviceContext *dc, int x, int y, int num, int numBase, Staff *staff);
525  void DrawLigatureNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff);
527 
536  void DrawTabClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
537  void DrawTabDurSym(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
538  void DrawTabGrp(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
539  void DrawTabNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
541 
547  void DrawTupletBracket(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
548  void DrawTupletNum(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
549 
555  void DrawVerticalLine(DeviceContext *dc, int y1, int y2, int x1, int width, int dashLength = 0, int gapLength = 0);
556  void DrawHorizontalLine(
557  DeviceContext *dc, int x1, int x2, int y1, int width, int dashLength = 0, int gapLength = 0);
558  void DrawObliqueLine(
559  DeviceContext *dc, int x1, int x2, int y1, int y2, int width, int dashLength = 0, int gapLength = 0);
560  void DrawVerticalSegmentedLine(
561  DeviceContext *dc, int x1, SegmentedLine &line, int width, int dashLength = 0, int gapLength = 0);
562  void DrawHorizontalSegmentedLine(
563  DeviceContext *dc, int y1, SegmentedLine &line, int width, int dashLength = 0, int gapLength = 0);
564  void DrawSmuflCode(
565  DeviceContext *dc, int x, int y, char32_t code, int staffSize, bool dimin, bool setBBGlyph = false);
566  // void DrawSmuflCodeWithCustomFont(DeviceContext *dc, const std::string &customFont, int x, int y, char32_t code,
567  // int staffSize, bool dimin, bool setBBGlyph = false);
568 
569  void DrawThickBezierCurve(
570  DeviceContext *dc, Point bezier[4], int thickness, int staffSize, int penWidth, PenStyle penStyle = PEN_SOLID);
571  void DrawTextString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
572  void DrawDirString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
573  void DrawDynamString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params, Rend *rend);
574  void DrawHarmString(DeviceContext *dc, const std::u32string &str, TextDrawingParams &params);
575  void DrawSmuflLine(DeviceContext *dc, Point orig, int length, int staffSize, bool dimin, char32_t fill,
576  char32_t start = 0, char32_t end = 0);
577  void DrawSmuflString(DeviceContext *dc, int x, int y, std::u32string s, data_HORIZONTALALIGNMENT alignment,
578  int staffSize = 100, bool dimin = false, bool setBBGlyph = false);
579  void DrawLyricString(DeviceContext *dc, const std::u32string &str, int staffSize = 100,
580  std::optional<TextDrawingParams> params = std::nullopt);
581  void DrawNotFilledEllipse(DeviceContext *dc, int x1, int y1, int x2, int y2, int lineThinkness);
582  void DrawFilledRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2);
583  void DrawNotFilledRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2, int lineThinkness, int radius);
584  void DrawFilledRoundedRectangle(DeviceContext *dc, int x1, int y1, int x2, int y2, int radius);
585  void DrawObliquePolygon(DeviceContext *dc, int x1, int y1, int x2, int y2, int height);
586  void DrawDiamond(DeviceContext *dc, int x1, int y1, int height, int width, bool fill, int linewidth);
587  void DrawDot(DeviceContext *dc, int x, int y, int staffSize, bool dimin = false);
588  void DrawSquareBracket(DeviceContext *dc, bool leftBracket, int x, int y, int height, int width,
589  int horizontalThickness, int verticalThickness);
590  void DrawEnclosingBrackets(DeviceContext *dc, int x, int y, int height, int width, int offset, int bracketWidth,
591  int horizontalThickness, int verticalThickness);
592  void DrawVerticalDots(DeviceContext *dc, int x, const SegmentedLine &line, int barlineWidth, int interval);
593  void DrawSymbolDef(DeviceContext *dc, Object *parent, SymbolDef *symbolDef, int x, int y, int staffSize, bool dimin,
594  data_HORIZONTALALIGNMENT alignement = HORIZONTALALIGNMENT_left);
596 
603 
604 private:
609  data_STEMDIRECTION GetTupletCoordinates(Tuplet *tuplet, Layer *layer, Point *start, Point *end, Point *center);
610  std::u32string IntToTupletFigures(unsigned short number);
611  std::u32string IntToTimeSigFigures(unsigned short number);
612  std::u32string IntToSmuflFigures(unsigned short number, int offset);
613  int NestedTuplets(Object *object);
614  int GetSylYRel(int verseN, Staff *staff, data_STAFFREL place, int voltaN = 1);
615  int GetFYRel(F *f, Staff *staff);
617 
622  FloatingCurvePositioner *CalcInitialSlur(
623  DeviceContext *dc, Slur *slur, int x1, int x2, Staff *staff, char spanningType);
625 
629  void CalcBrevisPoints(
630  Note *note, Staff *staff, Point *topLeft, Point *bottomRight, int sides[4], int shape, bool isMensuralBlack);
631  void CalcObliquePoints(Note *note1, Note *note2, Staff *staff, Point points[4], int sides[4], int shape,
632  bool isMensuralBlack, bool firstHalf, bool straight);
633 
638  void DrawBeamSegment(
639  DeviceContext *dc, BeamSegment *segment, BeamDrawingInterface *beamInterface, Layer *layer, Staff *staff);
640  void DrawFTremSegment(DeviceContext *dc, Staff *staff, FTrem *fTrem);
642 
646  bool HasValidTimeSpanningOrder(DeviceContext *dc, Object *element, LayerElement *start, LayerElement *end) const;
647 
651  data_STEMDIRECTION GetMensuralStemDir(Layer *layer, Note *note, int verticalCenter);
652 
659  void StartOffset(DeviceContext *dc, const Object *object, int staffSize);
660  void EndOffset(DeviceContext *dc, const Object *object);
661  void SetOffsetStaffSize(const Object *object, int staffSize);
663 
669  void CalcOffset(DeviceContext *dc, int &x, int &y);
670  void CalcOffsetX(DeviceContext *dc, int &x);
671  void CalcOffsetY(DeviceContext *dc, int &y);
672  void CalcOffsetSpanningStartX(DeviceContext *dc, int &x, char spanningType, double factor = 1.0);
673  void CalcOffsetSpanningEndX(DeviceContext *dc, int &x, char spanningType, double factor = 1.0);
674  void CalcOffsetSpanningStartY(DeviceContext *dc, int &y, char spanningType, double factor = 1.0);
675  void CalcOffsetSpanningEndY(DeviceContext *dc, int &y, char spanningType, double factor = 1.0);
676  void CalcOffsetBezier(DeviceContext *dc, Point points[4], char spanningType);
678 
682  class Offset {
683  public:
684  int m_ho = 0;
685  int m_vo = 0;
686  int m_startho = 0;
687  int m_startvo = 0;
688  int m_endho = 0;
689  int m_endvo = 0;
690  const Object *m_object = NULL;
691  int m_staffSize = 100;
692  };
693 
694 public:
699 
706  Page *m_currentPage;
708 
709 protected:
715 
719  SlurHandling m_slurHandling;
720 
727 
728 private:
730  int ConvertFontSizeNumeric(const data_FONTSIZE &fontSize, int staffSize) const;
731 
732  //----------------//
733  // Static members //
734  //----------------//
735 
737  static int ConvertFontPointSize(double pointSize);
738 
741  static thread_local int s_drawingLigX[2], s_drawingLigY[2];
742  static thread_local bool s_drawingLigObliqua;
744 
746  std::list<Offset> m_currentOffsets;
747 };
748 
749 } // namespace vrv
750 
751 #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:40
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:66
This class models the MEI <octave> element.
Definition: octave.h:31
This class contains the document styling parameters.
Definition: options.h:580
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:136
Definition: boundingbox.h:340
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:109
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:714
Options * m_options
Options of the document.
Definition: view.h:698
View()
Constructors and destructors.
void SetDoc(Doc *doc)
Set the document the view is pointing to (mandatory).
Doc * m_doc
Document.
Definition: view.h:696
ScoreDef m_drawingScoreDef
The current drawing score def.
Definition: view.h:726
SlurHandling GetSlurHandling() const
Control how slurs are handled.
Definition: view.h:178
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:719
bool GetNotationMode()
Simply returns the value of the last note-type element (mensural or neume)