MuseScore/libmscore/style.h

389 lines
8.7 KiB
C
Raw Normal View History

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 {
2012-05-26 14:26:10 +02:00
class Xml;
struct ChordDescription;
class PageFormat;
class ChordList;
class Element;
//---------------------------------------------------------
// StyleIdx
//---------------------------------------------------------
enum class StyleIdx : int {
NOSTYLE = -1,
2014-05-26 15:31:36 +02:00
staffUpperBorder,
staffLowerBorder,
staffDistance,
akkoladeDistance,
minSystemDistance,
maxSystemDistance,
lyricsDistance,
lyricsMinBottomDistance,
lyricsLineHeight,
figuredBassFontFamily,
figuredBassFontSize,
figuredBassYOffset,
figuredBassLineHeight,
figuredBassAlignment,
figuredBassStyle,
systemFrameDistance,
frameSystemDistance,
minMeasureWidth,
barWidth,
doubleBarWidth,
endBarWidth,
doubleBarDistance,
endBarDistance,
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,
ambitusMargin,
2014-05-26 15:31:36 +02:00
timesigLeftMargin,
clefKeyRightMargin,
2016-03-02 13:20:19 +01:00
/**/ clefKeyDistance,
/**/ clefTimesigDistance,
/**/ keyTimesigDistance,
keyBarlineDistance,
systemHeaderDistance,
systemHeaderTimeSigDistance,
2016-03-02 13:20:19 +01:00
2014-05-26 15:31:36 +02:00
clefBarlineDistance,
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,
hairpinY,
hairpinHeight,
hairpinContHeight,
hairpinLineWidth,
pedalY,
pedalLineWidth,
pedalLineStyle,
trillY,
harmonyY,
harmonyFretDist,
minHarmonyDistance,
maxHarmonyBarDistance,
capoPosition,
fretNumMag,
fretNumPos,
fretY,
showPageNumber,
showPageNumberOne,
pageNumberOddEven,
showMeasureNumber,
showMeasureNumberOne,
measureNumberInterval,
measureNumberSystem,
measureNumberAllStaffs,
smallNoteMag,
graceNoteMag,
smallStaffMag,
smallClefMag,
genClef,
genKeysig,
// genTimesig,
2014-05-26 15:31:36 +02:00
genCourtesyTimesig,
genCourtesyKeysig,
genCourtesyClef,
swingRatio,
swingUnit,
2014-05-26 15:31:36 +02:00
useStandardNoteNames,
useGermanNoteNames,
useFullGermanNoteNames,
2014-05-26 15:31:36 +02:00
useSolfeggioNoteNames,
useFrenchNoteNames,
automaticCapitalization,
2014-05-26 15:31:36 +02:00
lowerCaseMinorChords,
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,
2014-06-06 12:40:22 +02:00
// headerStyled,
2014-05-26 15:31:36 +02:00
headerFirstPage,
headerOddEven,
evenHeaderL,
evenHeaderC,
evenHeaderR,
oddHeaderL,
oddHeaderC,
oddHeaderR,
showFooter,
2014-06-06 12:40:22 +02:00
// footerStyled,
2014-05-26 15:31:36 +02:00
footerFirstPage,
footerOddEven,
evenFooterL,
evenFooterC,
evenFooterR,
oddFooterL,
oddFooterC,
oddFooterR,
voltaY,
voltaHook,
voltaLineWidth,
voltaLineStyle,
ottavaY,
ottavaHook,
ottavaLineWidth,
ottavaLineStyle,
ottavaNumbersOnly,
tabClef,
tremoloWidth,
tremoloBoxHeight,
tremoloStrokeWidth,
tremoloDistance,
// TODO tremoloBeamLengthMultiplier,
// TODO tremoloMaxBeamLength,
2014-05-26 15:31:36 +02:00
linearStretch,
crossMeasureValues,
keySigNaturals,
tupletMaxSlope,
tupletOufOfStaff,
tupletVHeadDistance,
tupletVStemDistance,
tupletStemLeftDistance,
tupletStemRightDistance,
tupletNoteLeftDistance,
tupletNoteRightDistance,
tupletBracketWidth,
tupletDirection,
tupletNumberType,
tupletBracketType,
2014-05-26 15:31:36 +02:00
barreLineWidth,
fretMag,
scaleBarlines,
barGraceDistance,
lyricsDashMinLength,
lyricsDashMaxLength,
lyricsDashForce,
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-03-03 17:10:50 +01:00
fermataAnchor,
shortfermataAnchor,
longfermataAnchor,
verylongfermataAnchor,
sforzatoAnchor,
staccatoAnchor,
staccatissimoAnchor,
tenutoAnchor,
portatoAnchor,
marcatoAnchor,
fadeinAnchor,
fadeoutAnchor,
volumeswellAnchor,
wigglesawtoothAnchor,
wigglesawtoothwideAnchor,
wigglevibratolargefasterAnchor,
wigglevibratolargeslowestAnchor,
ouvertAnchor,
plusstopAnchor,
upbowAnchor,
downbowAnchor,
reverseturnAnchor,
turnAnchor,
trillAnchor,
prallAnchor,
mordentAnchor,
prallprallAnchor,
prallmordentAnchor,
upprallAnchor,
downprallAnchor,
upmordentAnchor,
downmordentAnchor,
pralldownAnchor,
prallupAnchor,
lineprallAnchor,
schleiferAnchor,
snappizzicatoAnchor,
thumbAnchor,
lutefingeringthumbAnchor,
lutefingering1stAnchor,
lutefingering2ndAnchor,
lutefingering3rdAnchor,
2016-07-25 12:29:24 +02:00
autoplaceHairpinDynamicsDistance,
2014-05-26 15:31:36 +02:00
STYLES
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
void setChordList(ChordList*, bool custom = true); // Style gets ownership of ChordList
2012-05-26 14:26:10 +02:00
const TextStyle& textStyle(TextStyleType) const;
2012-05-26 14:26:10 +02:00
const TextStyle& textStyle(const QString& name) const;
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);
2012-05-26 14:26:10 +02:00
void save(Xml& xml, bool optimize);
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
2012-05-26 14:26:10 +02:00
ArticulationAnchor articulationAnchor(int id) const;
static StyleIdx articulationAnchorIdx(int id);
2015-01-22 16:27:16 +01:00
2016-03-02 13:20:19 +01:00
static const char* valueType(const StyleIdx);
static const char* valueName(const StyleIdx);
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