2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002-2011 Werner Schweer
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __STYLE_H__
|
|
|
|
#define __STYLE_H__
|
|
|
|
|
|
|
|
#include "mscore.h"
|
|
|
|
#include "spatium.h"
|
|
|
|
#include "articulation.h"
|
2016-03-02 13:20:19 +01:00
|
|
|
#include "page.h"
|
|
|
|
#include "chordlist.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2016-11-19 11:51:21 +01:00
|
|
|
class XmlWriter;
|
2012-05-26 14:26:10 +02:00
|
|
|
struct ChordDescription;
|
|
|
|
class PageFormat;
|
|
|
|
class ChordList;
|
|
|
|
class Element;
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// StyleIdx
|
2016-08-15 14:30:06 +02:00
|
|
|
//
|
|
|
|
// Keep in sync with styleTypes[] in style.cpp
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2016-07-08 19:33:17 +02:00
|
|
|
enum class StyleIdx : int {
|
|
|
|
NOSTYLE = -1,
|
2014-05-26 15:31:36 +02:00
|
|
|
staffUpperBorder,
|
|
|
|
staffLowerBorder,
|
|
|
|
staffDistance,
|
|
|
|
akkoladeDistance,
|
|
|
|
|
|
|
|
minSystemDistance,
|
|
|
|
maxSystemDistance,
|
|
|
|
|
2016-08-26 12:43:43 +02:00
|
|
|
lyricsPlacement,
|
|
|
|
lyricsPosAbove,
|
|
|
|
lyricsPosBelow,
|
2016-08-18 10:22:07 +02:00
|
|
|
lyricsMinTopDistance,
|
2014-05-26 15:31:36 +02:00
|
|
|
lyricsMinBottomDistance,
|
|
|
|
lyricsLineHeight,
|
2016-08-26 12:43:43 +02:00
|
|
|
lyricsDashMinLength,
|
|
|
|
lyricsDashMaxLength,
|
|
|
|
lyricsDashMaxDistance,
|
|
|
|
lyricsDashForce,
|
2016-08-26 13:42:59 +02:00
|
|
|
lyricsAlignVerseNumber,
|
2016-10-10 23:05:51 +02:00
|
|
|
lyricsLineThickness,
|
2014-05-26 15:31:36 +02:00
|
|
|
|
|
|
|
figuredBassFontFamily,
|
|
|
|
figuredBassFontSize,
|
|
|
|
figuredBassYOffset,
|
|
|
|
figuredBassLineHeight,
|
|
|
|
figuredBassAlignment,
|
|
|
|
figuredBassStyle,
|
|
|
|
systemFrameDistance,
|
|
|
|
frameSystemDistance,
|
|
|
|
minMeasureWidth,
|
|
|
|
|
|
|
|
barWidth,
|
|
|
|
doubleBarWidth,
|
|
|
|
endBarWidth,
|
|
|
|
doubleBarDistance,
|
|
|
|
endBarDistance,
|
2016-10-10 23:05:51 +02:00
|
|
|
repeatBarlineDotSeparation,
|
2014-05-26 15:31:36 +02:00
|
|
|
repeatBarTips,
|
|
|
|
startBarlineSingle,
|
|
|
|
startBarlineMultiple,
|
|
|
|
|
|
|
|
bracketWidth,
|
|
|
|
bracketDistance,
|
|
|
|
akkoladeWidth,
|
|
|
|
akkoladeBarDistance,
|
2015-07-25 08:43:02 +02:00
|
|
|
dividerLeft,
|
|
|
|
dividerLeftSym,
|
|
|
|
dividerLeftX,
|
|
|
|
dividerLeftY,
|
|
|
|
dividerRight,
|
|
|
|
dividerRightSym,
|
|
|
|
dividerRightX,
|
|
|
|
dividerRightY,
|
2014-05-26 15:31:36 +02:00
|
|
|
|
|
|
|
clefLeftMargin,
|
|
|
|
keysigLeftMargin,
|
2016-05-25 12:10:52 +02:00
|
|
|
ambitusMargin,
|
2014-05-26 15:31:36 +02:00
|
|
|
timesigLeftMargin,
|
|
|
|
|
|
|
|
clefKeyRightMargin,
|
2016-10-06 12:21:28 +02:00
|
|
|
clefKeyDistance,
|
|
|
|
clefTimesigDistance,
|
|
|
|
keyTimesigDistance,
|
2016-03-05 19:50:55 +01:00
|
|
|
keyBarlineDistance,
|
2016-04-19 15:18:17 +02:00
|
|
|
systemHeaderDistance,
|
2016-04-20 18:56:08 +02:00
|
|
|
systemHeaderTimeSigDistance,
|
2016-03-02 13:20:19 +01:00
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
clefBarlineDistance,
|
2016-05-04 10:27:40 +02:00
|
|
|
timesigBarlineDistance,
|
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
stemWidth,
|
|
|
|
shortenStem,
|
|
|
|
shortStemProgression,
|
|
|
|
shortestStem,
|
|
|
|
beginRepeatLeftMargin,
|
|
|
|
minNoteDistance,
|
|
|
|
barNoteDistance,
|
|
|
|
barAccidentalDistance,
|
|
|
|
multiMeasureRestMargin,
|
|
|
|
noteBarDistance,
|
|
|
|
|
|
|
|
measureSpacing,
|
|
|
|
staffLineWidth,
|
|
|
|
ledgerLineWidth,
|
|
|
|
ledgerLineLength,
|
|
|
|
accidentalDistance,
|
|
|
|
accidentalNoteDistance,
|
|
|
|
beamWidth,
|
|
|
|
beamDistance,
|
|
|
|
beamMinLen,
|
|
|
|
beamNoSlope,
|
|
|
|
|
|
|
|
dotMag,
|
|
|
|
dotNoteDistance,
|
|
|
|
dotRestDistance,
|
|
|
|
dotDotDistance,
|
|
|
|
propertyDistanceHead,
|
|
|
|
propertyDistanceStem,
|
|
|
|
propertyDistance,
|
|
|
|
articulationMag,
|
|
|
|
lastSystemFillLimit,
|
|
|
|
|
2016-11-18 14:28:53 +01:00
|
|
|
hairpinPlacement,
|
|
|
|
hairpinPosAbove,
|
|
|
|
hairpinPosBelow,
|
2014-05-26 15:31:36 +02:00
|
|
|
hairpinHeight,
|
|
|
|
hairpinContHeight,
|
|
|
|
hairpinLineWidth,
|
|
|
|
|
2016-11-18 14:28:53 +01:00
|
|
|
pedalPlacement,
|
|
|
|
pedalPosAbove,
|
|
|
|
pedalPosBelow,
|
2014-05-26 15:31:36 +02:00
|
|
|
pedalLineWidth,
|
|
|
|
pedalLineStyle,
|
|
|
|
|
2016-11-18 14:28:53 +01:00
|
|
|
trillPlacement,
|
|
|
|
trillPosAbove,
|
|
|
|
trillPosBelow,
|
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
harmonyY,
|
|
|
|
harmonyFretDist,
|
|
|
|
minHarmonyDistance,
|
|
|
|
maxHarmonyBarDistance,
|
|
|
|
capoPosition,
|
|
|
|
fretNumMag,
|
|
|
|
fretNumPos,
|
|
|
|
fretY,
|
|
|
|
|
|
|
|
showPageNumber,
|
|
|
|
showPageNumberOne,
|
|
|
|
pageNumberOddEven,
|
|
|
|
showMeasureNumber,
|
|
|
|
showMeasureNumberOne,
|
|
|
|
measureNumberInterval,
|
|
|
|
measureNumberSystem,
|
|
|
|
|
|
|
|
measureNumberAllStaffs,
|
|
|
|
smallNoteMag,
|
|
|
|
graceNoteMag,
|
|
|
|
smallStaffMag,
|
|
|
|
smallClefMag,
|
|
|
|
genClef,
|
|
|
|
genKeysig,
|
|
|
|
genCourtesyTimesig,
|
|
|
|
genCourtesyKeysig,
|
|
|
|
genCourtesyClef,
|
|
|
|
|
2014-06-21 15:16:17 +02:00
|
|
|
swingRatio,
|
|
|
|
swingUnit,
|
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
useStandardNoteNames,
|
|
|
|
useGermanNoteNames,
|
2014-12-10 08:12:00 +01:00
|
|
|
useFullGermanNoteNames,
|
2014-05-26 15:31:36 +02:00
|
|
|
useSolfeggioNoteNames,
|
2014-12-10 08:12:00 +01:00
|
|
|
useFrenchNoteNames,
|
2014-12-17 18:15:26 +01:00
|
|
|
automaticCapitalization,
|
2014-05-26 15:31:36 +02:00
|
|
|
lowerCaseMinorChords,
|
2014-12-10 08:12:00 +01:00
|
|
|
lowerCaseBassNotes,
|
|
|
|
allCapsNoteNames,
|
2014-05-26 15:31:36 +02:00
|
|
|
chordStyle,
|
|
|
|
chordsXmlFile,
|
|
|
|
chordDescriptionFile,
|
|
|
|
concertPitch,
|
|
|
|
createMultiMeasureRests,
|
|
|
|
minEmptyMeasures,
|
|
|
|
minMMRestWidth,
|
|
|
|
hideEmptyStaves,
|
|
|
|
dontHideStavesInFirstSystem,
|
|
|
|
hideInstrumentNameIfOneInstrument,
|
|
|
|
gateTime,
|
|
|
|
tenutoGateTime,
|
|
|
|
staccatoGateTime,
|
|
|
|
slurGateTime,
|
|
|
|
|
|
|
|
ArpeggioNoteDistance,
|
|
|
|
ArpeggioLineWidth,
|
|
|
|
ArpeggioHookLen,
|
|
|
|
|
|
|
|
SlurEndWidth,
|
|
|
|
SlurMidWidth,
|
|
|
|
SlurDottedWidth,
|
|
|
|
MinTieLength,
|
|
|
|
|
|
|
|
SectionPause,
|
|
|
|
MusicalSymbolFont,
|
2014-07-26 11:03:22 +02:00
|
|
|
MusicalTextFont,
|
2014-05-26 15:31:36 +02:00
|
|
|
|
|
|
|
showHeader,
|
|
|
|
headerFirstPage,
|
|
|
|
headerOddEven,
|
|
|
|
evenHeaderL,
|
|
|
|
evenHeaderC,
|
|
|
|
evenHeaderR,
|
|
|
|
oddHeaderL,
|
|
|
|
oddHeaderC,
|
|
|
|
oddHeaderR,
|
|
|
|
|
|
|
|
showFooter,
|
|
|
|
footerFirstPage,
|
|
|
|
footerOddEven,
|
|
|
|
evenFooterL,
|
|
|
|
evenFooterC,
|
|
|
|
evenFooterR,
|
|
|
|
oddFooterL,
|
|
|
|
oddFooterC,
|
|
|
|
oddFooterR,
|
|
|
|
|
|
|
|
voltaY,
|
|
|
|
voltaHook,
|
|
|
|
voltaLineWidth,
|
|
|
|
voltaLineStyle,
|
|
|
|
|
2016-11-18 14:28:53 +01:00
|
|
|
ottavaPlacement,
|
|
|
|
ottavaPosAbove,
|
|
|
|
ottavaPosBelow,
|
2014-05-26 15:31:36 +02:00
|
|
|
ottavaHook,
|
|
|
|
ottavaLineWidth,
|
|
|
|
ottavaLineStyle,
|
|
|
|
ottavaNumbersOnly,
|
|
|
|
|
|
|
|
tabClef,
|
|
|
|
|
|
|
|
tremoloWidth,
|
|
|
|
tremoloBoxHeight,
|
|
|
|
tremoloStrokeWidth,
|
|
|
|
tremoloDistance,
|
2015-06-22 17:41:06 +02:00
|
|
|
// TODO tremoloBeamLengthMultiplier,
|
|
|
|
// TODO tremoloMaxBeamLength,
|
2014-05-26 15:31:36 +02:00
|
|
|
|
|
|
|
linearStretch,
|
|
|
|
crossMeasureValues,
|
|
|
|
keySigNaturals,
|
|
|
|
|
|
|
|
tupletMaxSlope,
|
|
|
|
tupletOufOfStaff,
|
|
|
|
tupletVHeadDistance,
|
|
|
|
tupletVStemDistance,
|
|
|
|
tupletStemLeftDistance,
|
|
|
|
tupletStemRightDistance,
|
|
|
|
tupletNoteLeftDistance,
|
|
|
|
tupletNoteRightDistance,
|
2015-07-06 10:58:05 +02:00
|
|
|
tupletBracketWidth,
|
2016-07-08 16:48:04 +02:00
|
|
|
tupletDirection,
|
|
|
|
tupletNumberType,
|
|
|
|
tupletBracketType,
|
2014-05-26 15:31:36 +02:00
|
|
|
|
2015-01-16 14:51:09 +01:00
|
|
|
barreLineWidth,
|
|
|
|
fretMag,
|
2015-01-22 15:31:32 +01:00
|
|
|
scaleBarlines,
|
2015-01-26 10:23:35 +01:00
|
|
|
barGraceDistance,
|
2015-01-16 14:51:09 +01:00
|
|
|
|
2016-01-04 14:48:58 +01:00
|
|
|
minVerticalDistance,
|
2016-03-02 13:20:19 +01:00
|
|
|
ornamentStyle,
|
|
|
|
spatium,
|
2016-01-04 14:48:58 +01:00
|
|
|
|
2016-07-25 12:29:24 +02:00
|
|
|
autoplaceHairpinDynamicsDistance,
|
2016-11-18 14:28:53 +01:00
|
|
|
|
|
|
|
dynamicsPlacement,
|
|
|
|
dynamicsPosAbove,
|
|
|
|
dynamicsPosBelow,
|
|
|
|
|
2016-08-02 17:00:49 +02:00
|
|
|
dynamicsMinDistance,
|
2016-08-22 12:08:21 +02:00
|
|
|
autoplaceVerticalAlignRange,
|
2016-07-25 12:29:24 +02:00
|
|
|
|
2016-08-30 14:03:26 +02:00
|
|
|
textLinePlacement,
|
|
|
|
textLinePosAbove,
|
|
|
|
textLinePosBelow,
|
|
|
|
|
2016-09-20 17:13:54 +02:00
|
|
|
tremoloBarLineWidth,
|
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
STYLES
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2016-09-19 22:57:36 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// StyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
struct StyleType {
|
|
|
|
StyleIdx _idx;
|
|
|
|
const char* _name; // xml name for read()/write()
|
|
|
|
QVariant _defaultValue;
|
|
|
|
|
|
|
|
public:
|
|
|
|
StyleIdx styleIdx() const { return _idx; }
|
|
|
|
int idx() const { return int(_idx); }
|
|
|
|
const char* valueType() const { return _defaultValue.typeName(); }
|
|
|
|
const char* name() const { return _name; }
|
|
|
|
const QVariant& defaultValue() const { return _defaultValue; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// MStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class MStyle {
|
2016-03-02 13:20:19 +01:00
|
|
|
QVector<QVariant> _values;
|
|
|
|
QVector<qreal> _precomputedValues;
|
|
|
|
|
|
|
|
ChordList _chordList;
|
|
|
|
QList<TextStyle> _textStyles;
|
|
|
|
PageFormat _pageFormat;
|
|
|
|
|
|
|
|
bool _customChordList; // if true, chordlist will be saved as part of score
|
|
|
|
|
|
|
|
void precomputeValues();
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
MStyle();
|
|
|
|
MStyle(const MStyle&);
|
|
|
|
MStyle& operator=(const MStyle&);
|
2016-03-03 17:10:50 +01:00
|
|
|
// ~MStyle() {}
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
bool isDefault(StyleIdx idx) const;
|
|
|
|
const ChordDescription* chordDescription(int id) const;
|
2016-03-02 13:20:19 +01:00
|
|
|
ChordList* chordList() { return &_chordList; }
|
2014-03-15 12:15:49 +01:00
|
|
|
|
2013-06-11 20:26:16 +02:00
|
|
|
void setChordList(ChordList*, bool custom = true); // Style gets ownership of ChordList
|
2016-09-19 22:57:36 +02:00
|
|
|
void setCustomChordList(bool t) { _customChordList = t; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-07-03 11:22:42 +02:00
|
|
|
const TextStyle& textStyle(TextStyleType) const;
|
2016-09-19 22:57:36 +02:00
|
|
|
TextStyle& textStyle(TextStyleType);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
const TextStyle& textStyle(const QString& name) const;
|
2014-07-03 11:22:42 +02:00
|
|
|
TextStyleType textStyleType(const QString& name) const;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setTextStyle(const TextStyle& ts);
|
|
|
|
void addTextStyle(const TextStyle& ts);
|
|
|
|
void removeTextStyle(const TextStyle& ts);
|
|
|
|
const QList<TextStyle>& textStyles() const;
|
2013-08-09 11:42:24 +02:00
|
|
|
|
2016-03-02 13:20:19 +01:00
|
|
|
void set(StyleIdx idx, const QVariant& v);
|
|
|
|
|
|
|
|
QVariant value(StyleIdx idx) const { return _values[int(idx)]; }
|
|
|
|
qreal pvalue(StyleIdx idx) const { return _precomputedValues[int(idx)]; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
bool load(QFile* qf);
|
2013-01-11 18:10:18 +01:00
|
|
|
void load(XmlReader& e);
|
2016-11-19 11:51:21 +01:00
|
|
|
void save(XmlWriter& xml, bool optimize);
|
2016-09-20 17:13:54 +02:00
|
|
|
|
2016-09-19 22:57:36 +02:00
|
|
|
void convertToUnit(const QString& tag, const QString& val);
|
2016-03-02 13:20:19 +01:00
|
|
|
|
|
|
|
PageFormat* pageFormat() { return &_pageFormat; }
|
|
|
|
const PageFormat* pageFormat() const { return &_pageFormat; }
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
void setPageFormat(const PageFormat& pf);
|
2016-03-02 13:20:19 +01:00
|
|
|
|
|
|
|
static const char* valueType(const StyleIdx);
|
|
|
|
static const char* valueName(const StyleIdx);
|
2016-09-19 22:57:36 +02:00
|
|
|
static StyleIdx styleIdx(const QString& name);
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern void initStyle(MStyle*);
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
2014-03-10 10:50:12 +01:00
|
|
|
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|