LCOV - code coverage report
Current view: top level - src/importexport/capella/internal - capella.h Coverage Total Hit
Test: filtered_coverage.info Lines: 63.5 % 63 40
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #ifndef __CAPELLA_H__
      24              : #define __CAPELLA_H__
      25              : 
      26              : #include <QFont>
      27              : 
      28              : #include "engraving/types/types.h"
      29              : 
      30              : #define CAPELLA_TRACE_ENABLED 0
      31              : #if CAPELLA_TRACE_ENABLED
      32              : #define CAPELLA_TRACE LOGD
      33              : #else
      34              : #define CAPELLA_TRACE LOGN
      35              : #endif
      36              : 
      37              : class QFile;
      38              : 
      39              : namespace mu::engraving {
      40              : class XmlReader;
      41              : }
      42              : 
      43              : namespace mu::iex::capella {
      44              : enum class TIMESTEP : char {
      45              :     D1, D2, D4, D8, D16, D32, D64, D128, D256, D_BREVE
      46              : };
      47              : 
      48              : class Capella;
      49              : 
      50              : enum class CapellaNoteObjectType : char {
      51              :     REST, CHORD, CLEF, KEY, METER, EXPL_BARLINE, IMPL_BARLINE,
      52              :     PAGE_BKGR
      53              : };
      54              : 
      55              : enum class CapBeamMode : unsigned char {
      56              :     AUTO, FORCE, SPLIT
      57              : };
      58              : 
      59              : //---------------------------------------------------------
      60              : //   CapellaObj
      61              : //---------------------------------------------------------
      62              : 
      63              : class CapellaObj
      64              : {
      65              : protected:
      66              :     Capella* cap;
      67              : 
      68              : public:
      69         1310 :     CapellaObj(Capella* c) { cap = c; }
      70              : };
      71              : 
      72              : //---------------------------------------------------------
      73              : //   NoteObj
      74              : //---------------------------------------------------------
      75              : 
      76              : class NoteObj
      77              : {
      78              :     CapellaNoteObjectType _type;
      79              : 
      80              : public:
      81         1262 :     NoteObj(CapellaNoteObjectType t) { _type = t; }
      82         4341 :     CapellaNoteObjectType type() const { return _type; }
      83              : };
      84              : 
      85              : enum class Form : char {
      86              :     G, C, F, PERCUSSION,
      87              :     FORM_NULL, CLEF_UNCHANGED
      88              : };
      89              : 
      90              : enum class ClefLine : char {
      91              :     L5, L4, L3, L2, L1
      92              : };
      93              : 
      94              : enum class Oct : char {
      95              :     OCT_ALTA, OCT_NULL, OCT_BASSA
      96              : };
      97              : 
      98              : //---------------------------------------------------------
      99              : //   CapClef
     100              : //---------------------------------------------------------
     101              : 
     102              : class CapClef : public NoteObj, public CapellaObj
     103              : {
     104              :     Form form;
     105              : 
     106              : public:
     107           98 :     CapClef(Capella* c)
     108           98 :         : NoteObj(CapellaNoteObjectType::CLEF), CapellaObj(c) {}
     109              :     void read();
     110              :     void readCapx(engraving::XmlReader& e);
     111              :     const char* name()
     112              :     {
     113              :         static const char* formName[] = { "G", "C", "F", "=", " ", "*" };
     114              :         return formName[int(form)];
     115              :     }
     116              : 
     117              :     engraving::ClefType clef() const;
     118              : 
     119              :     ClefLine line;
     120              :     Oct oct;
     121              :     static engraving::ClefType clefType(Form, ClefLine, Oct);
     122              : };
     123              : 
     124              : //---------------------------------------------------------
     125              : //   CapKey
     126              : //---------------------------------------------------------
     127              : 
     128              : class CapKey : public NoteObj, public CapellaObj
     129              : {
     130              : public:
     131           47 :     CapKey(Capella* c)
     132           47 :         : NoteObj(CapellaNoteObjectType::KEY), CapellaObj(c) {}
     133              :     void read();
     134              :     void readCapx(engraving::XmlReader& e);
     135              :     int signature { 0 };      // -7 - +7
     136              : };
     137              : 
     138              : //---------------------------------------------------------
     139              : //   CapMeter
     140              : //---------------------------------------------------------
     141              : 
     142              : class CapMeter : public NoteObj, public CapellaObj
     143              : {
     144              : public:
     145              :     unsigned char numerator;
     146              :     int log2Denom;
     147              :     bool allaBreve;
     148              : 
     149           33 :     CapMeter(Capella* c)
     150           33 :         : NoteObj(CapellaNoteObjectType::METER), CapellaObj(c) {}
     151              :     void read();
     152              :     void readCapx(engraving::XmlReader& e);
     153              : };
     154              : 
     155              : //---------------------------------------------------------
     156              : //   CapExplicitBarline
     157              : //---------------------------------------------------------
     158              : 
     159              : class CapExplicitBarline : public NoteObj, public CapellaObj
     160              : {
     161              :     engraving::BarLineType _type { engraving::BarLineType::NORMAL };
     162              :     int _barMode      { 0 };        // 0 = auto, 1 = nur Zeilen, 2 = durchgezogen
     163              : 
     164              : public:
     165            5 :     CapExplicitBarline(Capella* c)
     166            5 :         : NoteObj(CapellaNoteObjectType::EXPL_BARLINE), CapellaObj(c) {}
     167              :     void read();
     168              :     void readCapx(engraving::XmlReader& e);
     169            5 :     engraving::BarLineType type() const { return _type; }
     170              :     int barMode() const { return _barMode; }
     171              : };
     172              : 
     173              : //---------------------------------------------------------
     174              : //   CapVoice
     175              : //---------------------------------------------------------
     176              : 
     177              : struct CapVoice {
     178              :     uchar y0Lyrics;
     179              :     uchar dyLyrics;
     180              :     QFont lyricsFont;
     181              :     unsigned char stemDir;
     182              :     QList<NoteObj*> objects;
     183              :     int voiceNo;
     184              : };
     185              : 
     186              : //---------------------------------------------------------
     187              : //   CapStaff
     188              : //---------------------------------------------------------
     189              : 
     190              : struct CapStaff {
     191              :     uchar numerator;        // default time signature
     192              :     int log2Denom;
     193              :     bool allaBreve;
     194              : 
     195              :     uchar iLayout;
     196              :     int topDistX;
     197              :     int btmDistX;
     198              :     QColor color;
     199              :     QList<CapVoice*> voices;
     200              : };
     201              : 
     202              : //---------------------------------------------------------
     203              : //   struct CapStaffLayout
     204              : //---------------------------------------------------------
     205              : 
     206              : struct CapStaffLayout {
     207              :     uchar barlineMode;
     208              :     uchar noteLines;
     209              :     bool bSmall;
     210              :     int topDist;
     211              :     int btmDist;
     212              :     int groupDist;
     213              :     uchar barlineFrom;
     214              :     uchar barlineTo;
     215              : 
     216              :     Form form;
     217              :     ClefLine line;
     218              :     Oct oct;                  // clef
     219              : 
     220              :     // Schlagzeuginformation
     221              :     bool bPercussion;               // use drum channel
     222              :     bool bSoundMapIn;
     223              :     bool bSoundMapOut;
     224              :     char soundMapIn[128];           // Tabelle für MIDI-Töne iMin...iMin+n-1
     225              :     char soundMapOut[128];          // Tabelle für MIDI-Töne iMin...iMin+n-1
     226              : 
     227              :     int sound, volume, transp;
     228              : 
     229              :     QString descr;
     230              :     QString name;
     231              :     QString abbrev;
     232              :     QString intermediateName;
     233              :     QString intermediateAbbrev;
     234              : };
     235              : 
     236              : //---------------------------------------------------------
     237              : //   CapSystem
     238              : //---------------------------------------------------------
     239              : 
     240              : struct CapSystem {
     241              :     int nAddBarCount;
     242              :     bool bBarCountReset;
     243              :     unsigned char explLeftIndent;        // < 0 --> Einrückung gemäß Stimmenbezeichnungen
     244              :                                          // >=  --> explizite Einrückung
     245              :     CapBeamMode beamMode;
     246              :     unsigned tempo;
     247              :     QColor color;                   // fuer Systemklammern
     248              :     bool bJustified;                // Randausgleich (Blocksatz)
     249              :     bool bPageBreak;                // nach dem System neue Seite anfangen
     250              :     int instrNotation;              // 0 = keine Instrumentenbezeichnung
     251              :                                     // 1 = abgekürzt, 2 = vollständig
     252              :     QList<CapStaff*> staves;
     253              : };
     254              : 
     255              : //---------------------------------------------------------
     256              : //   BasicDrawObj
     257              : //---------------------------------------------------------
     258              : 
     259              : enum class CapellaType : unsigned char {
     260              :     GROUP, TRANSPOSABLE, METAFILE, SIMPLE_TEXT, TEXT, RECT_ELLIPSE,
     261              :     LINE, POLYGON, WAVY_LINE, SLUR, NOTE_LINES, WEDGE, VOLTA,
     262              :     BRACKET, GUITAR, TRILL
     263              : };
     264              : 
     265              : class BasicDrawObj : public CapellaObj
     266              : {
     267              : public:
     268              :     unsigned char modeX, modeY, distY, flags;
     269              :     int nRefNote;
     270              :     int nNotes;
     271              :     bool background;
     272              :     int pageRange;
     273              :     CapellaType type;
     274              : 
     275           48 :     BasicDrawObj(CapellaType t, Capella* c)
     276           96 :         : CapellaObj(c), modeX(0), modeY(0), distY(0), flags(0),
     277           48 :         nRefNote(0), nNotes(0), background(0), pageRange(0), type(t) {}
     278              :     void read();
     279              :     void readCapx(engraving::XmlReader& e);
     280              : };
     281              : 
     282              : //---------------------------------------------------------
     283              : //   BasicRectObj
     284              : //---------------------------------------------------------
     285              : 
     286              : class BasicRectObj : public BasicDrawObj
     287              : {
     288              : public:
     289            4 :     BasicRectObj(CapellaType t, Capella* c)
     290            4 :         : BasicDrawObj(t, c) {}
     291              :     void read();
     292              : 
     293              :     QPointF relPos;
     294              :     int width;
     295              :     int yxRatio;
     296              :     int height;
     297              : };
     298              : 
     299              : //---------------------------------------------------------
     300              : //   GroupObj
     301              : //---------------------------------------------------------
     302              : 
     303              : class GroupObj : public BasicDrawObj
     304              : {
     305              : public:
     306            0 :     GroupObj(Capella* c)
     307            0 :         : BasicDrawObj(CapellaType::GROUP, c) {}
     308              :     void read();
     309              : 
     310              :     QPointF relPos;
     311              :     QList<BasicDrawObj*> objects;
     312              : };
     313              : 
     314              : //---------------------------------------------------------
     315              : //   TransposableObj
     316              : //---------------------------------------------------------
     317              : 
     318              : class TransposableObj : public BasicDrawObj
     319              : {
     320              : public:
     321            0 :     TransposableObj(Capella* c)
     322            0 :         : BasicDrawObj(CapellaType::TRANSPOSABLE, c) {}
     323              :     void read();
     324              :     void readCapx(engraving::XmlReader& e);
     325              : 
     326              :     QPointF relPos;
     327              :     char b { 0 };
     328              :     QList<BasicDrawObj*> variants;
     329              : };
     330              : 
     331              : //---------------------------------------------------------
     332              : //   MetafileObj
     333              : //---------------------------------------------------------
     334              : 
     335              : class MetafileObj : public BasicRectObj
     336              : {
     337              : public:
     338            2 :     MetafileObj(Capella* c)
     339            2 :         : BasicRectObj(CapellaType::METAFILE, c) {}
     340              :     void read();
     341              : };
     342              : 
     343              : //---------------------------------------------------------
     344              : //   LineObj
     345              : //---------------------------------------------------------
     346              : 
     347              : class LineObj : public BasicDrawObj
     348              : {
     349              : public:
     350            0 :     LineObj(Capella* c)
     351            0 :         : BasicDrawObj(CapellaType::LINE, c) {}
     352           32 :     LineObj(CapellaType t, Capella* c)
     353           32 :         : BasicDrawObj(t, c) {}
     354              :     void read();
     355              : 
     356              :     QPointF pt1, pt2;
     357              :     QColor color;
     358              :     char lineWidth { 0 };
     359              : };
     360              : 
     361              : //---------------------------------------------------------
     362              : //   RectEllipseObj
     363              : //---------------------------------------------------------
     364              : 
     365              : class RectEllipseObj : public LineObj      // special
     366              : {
     367              : public:
     368            0 :     RectEllipseObj(Capella* c)
     369            0 :         : LineObj(CapellaType::RECT_ELLIPSE, c) {}
     370              :     void read();
     371              : 
     372              :     int radius;
     373              :     bool bFilled;
     374              :     QColor clrFill;
     375              : };
     376              : 
     377              : //---------------------------------------------------------
     378              : //   PolygonObj
     379              : //---------------------------------------------------------
     380              : 
     381              : class PolygonObj : public BasicDrawObj
     382              : {
     383              : public:
     384            0 :     PolygonObj(Capella* c)
     385            0 :         : BasicDrawObj(CapellaType::POLYGON, c) {}
     386              :     void read();
     387              : 
     388              :     bool bFilled;
     389              :     unsigned lineWidth;
     390              :     QColor clrFill;
     391              :     QColor clrLine;
     392              : };
     393              : 
     394              : //---------------------------------------------------------
     395              : //   WavyLineObj
     396              : //---------------------------------------------------------
     397              : 
     398              : class WavyLineObj : public LineObj
     399              : {
     400              : public:
     401            0 :     WavyLineObj(Capella* c)
     402            0 :         : LineObj(CapellaType::WAVY_LINE, c) {}
     403              :     void read();
     404              : 
     405              :     unsigned waveLen;
     406              :     bool adapt;
     407              : };
     408              : 
     409              : //---------------------------------------------------------
     410              : //   NotelinesObj
     411              : //---------------------------------------------------------
     412              : 
     413              : class NotelinesObj : public BasicDrawObj
     414              : {
     415              : public:
     416            0 :     NotelinesObj(Capella* c)
     417            0 :         : BasicDrawObj(CapellaType::NOTE_LINES, c) {}
     418              :     void read();
     419              : 
     420              :     int x0, x1, y;
     421              :     QColor color;
     422              : };
     423              : 
     424              : //---------------------------------------------------------
     425              : //   VoltaObj
     426              : //---------------------------------------------------------
     427              : 
     428              : class VoltaObj : public BasicDrawObj
     429              : {
     430              : public:
     431            2 :     VoltaObj(Capella* c)
     432            4 :         : BasicDrawObj(CapellaType::VOLTA, c), x0(0), x1(0), y(0),
     433            2 :         bLeft(false), bRight(false), bDotted(false),
     434            2 :         allNumbers(false), from(0), to(0) {}
     435              :     void read();
     436              :     void readCapx(engraving::XmlReader& e);
     437              : 
     438              :     int x0, x1, y;
     439              :     QColor color;
     440              : 
     441              :     bool bLeft;
     442              :     bool bRight;
     443              :     bool bDotted;
     444              :     bool allNumbers;
     445              : 
     446              :     int from, to;
     447              : };
     448              : 
     449              : //---------------------------------------------------------
     450              : //   GuitarObj
     451              : //---------------------------------------------------------
     452              : 
     453              : class GuitarObj : public BasicDrawObj
     454              : {
     455              : public:
     456            0 :     GuitarObj(Capella* c)
     457            0 :         : BasicDrawObj(CapellaType::GUITAR, c) {}
     458              :     void read();
     459              : 
     460              :     QPointF relPos;
     461              :     QColor color;
     462              :     short flags;
     463              :     int strings;        // 8 Saiten in 8 Halbbytes
     464              : };
     465              : 
     466              : //---------------------------------------------------------
     467              : //   TrillObj
     468              : //---------------------------------------------------------
     469              : 
     470              : class TrillObj : public BasicDrawObj
     471              : {
     472              : public:
     473            0 :     TrillObj(Capella* c)
     474            0 :         : BasicDrawObj(CapellaType::TRILL, c), x0(0),
     475            0 :         x1(0), y(0), trillSign(true) {}
     476              :     void read();
     477              :     void readCapx(engraving::XmlReader& e);
     478              : 
     479              :     int x0, x1, y;
     480              :     QColor color;
     481              :     bool trillSign;
     482              : };
     483              : 
     484              : //---------------------------------------------------------
     485              : //   SlurObj
     486              : //---------------------------------------------------------
     487              : 
     488              : class SlurObj : public BasicDrawObj
     489              : {
     490              :     QPointF bezierPoint[4];   // note default constructor inits to (0, 0)
     491              :     QColor color;             // note default constructor inits to invalid
     492              : 
     493              : public:
     494            4 :     SlurObj(Capella* c)
     495            4 :         : BasicDrawObj(CapellaType::SLUR, c), color(Qt::black), nEnd(0), nMid(0), nDotDist(0), nDotWidth(0) {}
     496              :     void read();
     497              :     void readCapx(engraving::XmlReader& e);
     498              :     unsigned char nEnd, nMid, nDotDist, nDotWidth;
     499              : };
     500              : 
     501              : //---------------------------------------------------------
     502              : //   TextObj
     503              : //---------------------------------------------------------
     504              : 
     505              : class TextObj : public BasicRectObj
     506              : {
     507              : public:
     508            2 :     TextObj(Capella* c)
     509            2 :         : BasicRectObj(CapellaType::TEXT, c) {}
     510              :     ~TextObj() {}
     511              :     void read();
     512              : 
     513              :     QString text;
     514              : };
     515              : 
     516              : //---------------------------------------------------------
     517              : //   SimpleTextObj
     518              : //---------------------------------------------------------
     519              : 
     520              : class SimpleTextObj : public BasicDrawObj
     521              : {
     522              :     QString _text;
     523              :     QPointF relPos;
     524              :     unsigned char align;
     525              :     QFont _font;
     526              : 
     527              : public:
     528            6 :     SimpleTextObj(Capella* c)
     529            6 :         : BasicDrawObj(CapellaType::SIMPLE_TEXT, c), relPos(0, 0), align(0) {}
     530              :     void read();
     531              :     void readCapx(engraving::XmlReader& e);
     532            6 :     QString text() const { return _text; }
     533           12 :     QFont font() const { return _font; }
     534            6 :     QPointF pos() const { return relPos; }
     535            6 :     unsigned char textalign() const { return align; }
     536              : };
     537              : 
     538              : //---------------------------------------------------------
     539              : //   BracketObj
     540              : //---------------------------------------------------------
     541              : 
     542              : class BracketObj : public LineObj
     543              : {
     544              : public:
     545           32 :     BracketObj(Capella* c)
     546           32 :         : LineObj(CapellaType::BRACKET, c) {}
     547              :     void read();
     548              :     void readCapx(engraving::XmlReader& e);
     549              : 
     550              :     char orientation, number;
     551              : };
     552              : 
     553              : //---------------------------------------------------------
     554              : //   WedgeObj
     555              : //---------------------------------------------------------
     556              : 
     557              : class WedgeObj : public LineObj
     558              : {
     559              : public:
     560            0 :     WedgeObj(Capella* c)
     561            0 :         : LineObj(CapellaType::WEDGE, c), height(32),
     562            0 :         decresc(false) {}
     563              :     void read();
     564              :     void readCapx(engraving::XmlReader& e);
     565              : 
     566              :     int height;
     567              :     bool decresc;
     568              : };
     569              : 
     570              : //---------------------------------------------------------
     571              : //   BasicDurationalObj
     572              : //---------------------------------------------------------
     573              : 
     574              : class BasicDurationalObj : public CapellaObj
     575              : {
     576              : public:
     577              :     int nDots;
     578              :     bool noDuration;
     579              :     bool postGrace;
     580              :     bool bSmall;
     581              :     bool notBlack;
     582              :     QColor color;
     583              :     TIMESTEP t;
     584              :     int horizontalShift;
     585              :     int tupletDenominator;           // tuplet type  --  will be used as a count if no separate count is determined
     586              :     bool tupletStart  = false;       // To correctly read Tuplets with mixed durations
     587              :     bool tupletEnd    = false;       // we infer from the Capella file start/stop from the brackets.
     588              :     int tupletCount  = 0;            // Real count of the tuplet notes ...
     589              :     engraving::Fraction tupletTicks; // ... and the ticks of the tuplet, used to calculate the end of the tuplet
     590              :     bool tripartite;
     591              :     bool isProlonging;
     592              : 
     593              : public:
     594         1079 :     BasicDurationalObj(Capella* c)
     595         1079 :         : CapellaObj(c) {}
     596              :     void read();
     597              :     void readCapx(engraving::XmlReader& e, unsigned int& fullm);
     598              :     void readCapxDisplay(engraving::XmlReader& e);
     599              :     void readCapxObjectArray(engraving::XmlReader& e);
     600              :     engraving::Fraction ticks() const;
     601              :     bool invisible;
     602              :     QList<BasicDrawObj*> objects;
     603              : };
     604              : 
     605              : //---------------------------------------------------------
     606              : //   Verse
     607              : //---------------------------------------------------------
     608              : 
     609              : struct Verse {
     610              :     bool leftAlign;
     611              :     bool extender;
     612              :     bool hyphen;
     613              :     int num;
     614              :     QString verseNumber;
     615              :     QString text;
     616              : };
     617              : 
     618              : struct CNote {
     619              :     signed char pitch;
     620              :     int explAlteration;       // 1 force, 2 suppress
     621              :     int headType;
     622              :     int headGroup;
     623              :     int alteration;
     624              :     int silent;
     625              : };
     626              : 
     627              : //---------------------------------------------------------
     628              : //   ChordObj
     629              : //---------------------------------------------------------
     630              : 
     631              : class ChordObj : public BasicDurationalObj, public NoteObj
     632              : {
     633              : public:
     634              :     enum class StemDir : signed char {
     635              :         DOWN = -1, AUTO = 0, UP = 1, NONE = 3
     636              :     };
     637              :     CapBeamMode beamMode;
     638              :     signed char notationStave;
     639              :     char dStemLength;
     640              :     unsigned char nTremoloBars;
     641              :     unsigned articulation;
     642              :     bool leftTie;
     643              :     bool rightTie;
     644              :     char beamShift;
     645              :     char beamSlope;
     646              : 
     647              : public:
     648              :     ChordObj(Capella*);
     649              :     void read();
     650              :     void readCapx(engraving::XmlReader& e);
     651              :     void readCapxLyrics(engraving::XmlReader& e);
     652              :     void readCapxNotes(engraving::XmlReader& e);
     653              :     void readCapxStem(engraving::XmlReader& e);
     654              :     void readCapxArticulation(engraving::XmlReader& e);
     655              :     QList<Verse> verse;
     656              :     QList<CNote> notes;
     657              :     StemDir stemDir;
     658              : };
     659              : 
     660              : //---------------------------------------------------------
     661              : //   RestObj
     662              : //---------------------------------------------------------
     663              : 
     664              : class RestObj : public BasicDurationalObj, public NoteObj
     665              : {
     666              :     bool bVerticalCentered { false };
     667              :     int vertShift          { 0 };
     668              : 
     669              : public:
     670              :     RestObj(Capella*);
     671              :     void read();
     672              :     void readCapx(engraving::XmlReader& e);
     673              :     unsigned fullMeasures;    // >0, multi measure rest (counting measures)
     674              : };
     675              : 
     676              : //---------------------------------------------------------
     677              : //   CapFont
     678              : //---------------------------------------------------------
     679              : 
     680              : struct CapFont {
     681              :     QString face;
     682              : };
     683              : 
     684              : //---------------------------------------------------------
     685              : //   CapBracket
     686              : //---------------------------------------------------------
     687              : 
     688              : struct CapBracket {
     689              :     int from, to;
     690              :     bool curly;
     691              : };
     692              : 
     693              : //---------------------------------------------------------
     694              : //   Capella
     695              : //---------------------------------------------------------
     696              : 
     697              : class Capella
     698              : {
     699              :     static const char* errmsg[];
     700              :     qint64 curPos;
     701              : 
     702              :     QFile* f;
     703              :     char* author;
     704              :     char* keywords;
     705              :     char* comment;
     706              : 
     707              :     unsigned char beamRelMin0;
     708              :     unsigned char beamRelMin1;
     709              :     unsigned char beamRelMax0;
     710              :     unsigned char beamRelMax1;
     711              :     unsigned nRel;                  // presentation parameter
     712              :     unsigned nAbs;
     713              :     bool bUseRealSize;
     714              :     bool bAllowCompression;
     715              :     bool bPrintLandscape;
     716              : 
     717              :     bool bShowBarCount;             // Taktnumerierung zeigen
     718              :     unsigned char barNumberFrame;   // 0=kein, 1=Rechteck, 2=Ellipse
     719              :     unsigned char nBarDistX;
     720              :     unsigned char nBarDistY;
     721              :     // LogFont       barNumFont;
     722              : 
     723              :     unsigned nFirstPage;            // Versatz fuer Seitenzaehlung
     724              : 
     725              :     unsigned leftPageMargins;       // Seitenraender
     726              :     unsigned topPageMargins;
     727              :     unsigned rightPageMargins;
     728              :     unsigned btmPageMargins;
     729              : 
     730              :     QList<QFont> fonts;
     731              :     QList<CapStaffLayout*> _staffLayouts;        // staff layout
     732              : 
     733              :     int interDist;
     734              :     unsigned char txtAlign;         // Stimmenbezeichnungen 0=links, 1=zentriert, 2=rechts
     735              :     unsigned char adjustVert;       // 0=nein, 1=außer letzte Seite, 3=alle Seiten
     736              :     bool redundantKeys;
     737              :     bool modernDoubleNote;
     738              :     bool bSystemSeparators;
     739              :     int nUnnamed;
     740              :     QFont namesFont;
     741              : 
     742              :     void readVoice(CapStaff*, int);
     743              :     void readStaff(CapSystem*);
     744              :     void readSystem();
     745              : 
     746              : protected:
     747              :     void readStaveLayout(CapStaffLayout*, int);
     748              :     void readLayout();
     749              : 
     750              : public:
     751              :     enum class Error : char {
     752              :         CAP_NO_ERROR, BAD_SIG, CAP_EOF, BAD_VOICE_SIG,
     753              :         BAD_STAFF_SIG, BAD_SYSTEM_SIG, BAD_FORMAT,
     754              :     };
     755              : 
     756              :     Capella();
     757              :     ~Capella();
     758              :     void read(QFile*);
     759            0 :     QString error(Error n) const { return QString(errmsg[int(n)]); }
     760              : 
     761              :     unsigned char readByte();
     762              :     char readChar();
     763              :     QColor readColor();
     764              :     int readInt();
     765              :     int readLong();
     766              :     short readWord();
     767              :     int readDWord();
     768              :     unsigned readUnsigned();
     769              :     void verifyLength(unsigned len) const;
     770              :     char* readString();
     771              :     QString readQString();
     772              :     void readExtra();
     773              :     QList<BasicDrawObj*> readDrawObjectArray();
     774              :     bool read(void* p, qint64 len);
     775              :     QFont readFont();
     776              :     QPointF readPoint();
     777              : 
     778              :     QList<CapSystem*> systems;
     779              :     QList<CapBracket> brackets;
     780              :     ChordObj* backgroundChord;
     781              :     CapStaffLayout* staffLayout(int idx);
     782           78 :     const QList<CapStaffLayout*>& staffLayouts() const { return _staffLayouts; }
     783              : 
     784              :     double smallLineDist;              // spatium unit in metric mm
     785              :     double normalLineDist;
     786              :     int topDist;
     787              : // capx support
     788              : private:
     789              :     void readCapxVoice(engraving::XmlReader& e, CapStaff*, int);
     790              :     void readCapxStaff(engraving::XmlReader& e, CapSystem*);
     791              :     void readCapxSystem(engraving::XmlReader& e);
     792              :     void capxSystems(engraving::XmlReader& e);
     793              :     void readCapxStaveLayout(engraving::XmlReader& e, CapStaffLayout*, int);
     794              :     void capxLayoutStaves(engraving::XmlReader& e);
     795              :     void capxLayout(engraving::XmlReader& e);
     796              :     void initCapxLayout();
     797              : public:
     798              :     void readCapx(engraving::XmlReader& e);
     799              :     QList<BasicDrawObj*> readCapxDrawObjectArray(engraving::XmlReader& e);
     800              : };
     801              : } // namespace Ms
     802              : #endif
        

Generated by: LCOV version 2.0-1