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
|
|
|
|
//=============================================================================
|
|
|
|
|
2013-07-23 16:43:56 +02:00
|
|
|
#include <unordered_map>
|
2012-05-26 14:26:10 +02:00
|
|
|
#include "mscore.h"
|
|
|
|
#include "style.h"
|
|
|
|
#include "style_p.h"
|
|
|
|
#include "xml.h"
|
|
|
|
#include "score.h"
|
|
|
|
#include "articulation.h"
|
|
|
|
#include "harmony.h"
|
|
|
|
#include "chordlist.h"
|
|
|
|
#include "page.h"
|
|
|
|
#include "mscore.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
MStyle* style;
|
|
|
|
|
|
|
|
// 20 points font design size
|
|
|
|
// 72 points/inch point size
|
|
|
|
// 120 dpi screen resolution
|
|
|
|
// spatium = 20/4 points
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// styleTypes
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-07-23 16:43:56 +02:00
|
|
|
struct StyleTypes2 {
|
|
|
|
StyleIdx idx;
|
|
|
|
StyleType val;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-07-23 16:43:56 +02:00
|
|
|
static const StyleTypes2 styleTypes2[] = {
|
|
|
|
{ ST_staffUpperBorder, StyleType("staffUpperBorder", ST_SPATIUM) },
|
|
|
|
{ ST_staffLowerBorder, StyleType("staffLowerBorder", ST_SPATIUM) },
|
|
|
|
{ ST_staffDistance, StyleType("staffDistance", ST_SPATIUM) },
|
|
|
|
{ ST_akkoladeDistance, StyleType("akkoladeDistance", ST_SPATIUM) },
|
|
|
|
{ ST_minSystemDistance, StyleType("minSystemDistance", ST_SPATIUM) },
|
|
|
|
{ ST_maxSystemDistance, StyleType("maxSystemDistance", ST_SPATIUM) },
|
|
|
|
{ ST_lyricsDistance, StyleType("lyricsDistance", ST_SPATIUM) },
|
|
|
|
{ ST_lyricsMinBottomDistance, StyleType("lyricsMinBottomDistance", ST_SPATIUM) },
|
|
|
|
{ ST_lyricsLineHeight, StyleType("lyricsLineHeight", ST_DOUBLE) }, // in % of normal height (default: 1.0)
|
|
|
|
{ ST_figuredBassFontFamily, StyleType("figuredBassFontFamily", ST_STRING) },
|
|
|
|
{ ST_figuredBassFontSize, StyleType("figuredBassFontSize", ST_DOUBLE) }, // in pt
|
|
|
|
{ ST_figuredBassYOffset, StyleType("figuredBassYOffset", ST_DOUBLE) }, // in sp
|
|
|
|
{ ST_figuredBassLineHeight, StyleType("figuredBassLineHeight", ST_DOUBLE) }, // in % of normal height
|
|
|
|
{ ST_figuredBassAlignment, StyleType("figuredBassAlignment", ST_INT) }, // 0 = top, 1 = bottom
|
|
|
|
{ ST_figuredBassStyle, StyleType("figuredBassStyle" , ST_INT) }, // 0=modern, 1=historic
|
|
|
|
{ ST_systemFrameDistance, StyleType("systemFrameDistance", ST_SPATIUM) }, // dist. between staff and vertical box
|
|
|
|
{ ST_frameSystemDistance, StyleType("frameSystemDistance", ST_SPATIUM) }, // dist. between vertical box and next system
|
|
|
|
{ ST_minMeasureWidth, StyleType("minMeasureWidth", ST_SPATIUM) },
|
|
|
|
{ ST_barWidth, StyleType("barWidth", ST_SPATIUM) },
|
|
|
|
{ ST_doubleBarWidth, StyleType("doubleBarWidth", ST_SPATIUM) },
|
|
|
|
{ ST_endBarWidth, StyleType("endBarWidth", ST_SPATIUM) },
|
|
|
|
{ ST_doubleBarDistance, StyleType("doubleBarDistance", ST_SPATIUM) },
|
|
|
|
{ ST_endBarDistance, StyleType("endBarDistance", ST_SPATIUM) },
|
|
|
|
{ ST_repeatBarTips, StyleType("repeatBarTips", ST_BOOL) },
|
|
|
|
{ ST_startBarlineSingle, StyleType("startBarlineSingle", ST_BOOL) },
|
|
|
|
{ ST_startBarlineMultiple, StyleType("startBarlineMultiple", ST_BOOL) },
|
|
|
|
{ ST_bracketWidth, StyleType("bracketWidth", ST_SPATIUM) }, // system bracket line width
|
|
|
|
{ ST_bracketDistance, StyleType("bracketDistance", ST_SPATIUM) }, // system bracket distance
|
|
|
|
{ ST_akkoladeWidth, StyleType("akkoladeWidth", ST_SPATIUM) },
|
|
|
|
{ ST_akkoladeBarDistance, StyleType("akkoladeBarDistance", ST_SPATIUM) },
|
|
|
|
{ ST_clefLeftMargin, StyleType("clefLeftMargin", ST_SPATIUM) },
|
|
|
|
{ ST_keysigLeftMargin, StyleType("keysigLeftMargin", ST_SPATIUM) },
|
|
|
|
{ ST_timesigLeftMargin, StyleType("timesigLeftMargin", ST_SPATIUM) },
|
|
|
|
{ ST_clefKeyRightMargin, StyleType("clefKeyRightMargin", ST_SPATIUM) },
|
|
|
|
{ ST_clefBarlineDistance, StyleType("clefBarlineDistance", ST_SPATIUM) },
|
|
|
|
{ ST_stemWidth, StyleType("stemWidth", ST_SPATIUM) },
|
|
|
|
{ ST_shortenStem, StyleType("shortenStem", ST_BOOL) }, // ST_shortenStem,
|
|
|
|
{ ST_shortStemProgression, StyleType("shortStemProgression", ST_SPATIUM) }, // ST_shortStemProgression,
|
|
|
|
{ ST_shortestStem, StyleType("shortestStem", ST_SPATIUM) },
|
|
|
|
{ ST_beginRepeatLeftMargin, StyleType("beginRepeatLeftMargin", ST_SPATIUM) },
|
|
|
|
{ ST_minNoteDistance, StyleType("minNoteDistance", ST_SPATIUM) },
|
|
|
|
{ ST_barNoteDistance, StyleType("barNoteDistance", ST_SPATIUM) },
|
|
|
|
{ ST_barAccidentalDistance, StyleType("barAccidentalDistance", ST_SPATIUM) },
|
2013-07-26 01:31:11 +02:00
|
|
|
{ ST_multiMeasureRestMargin, StyleType("multiMeasureRestMargin", ST_SPATIUM) },
|
|
|
|
{ ST_noteBarDistance, StyleType("noteBarDistance", ST_SPATIUM) },
|
|
|
|
{ ST_measureSpacing, StyleType("measureSpacing", ST_DOUBLE) },
|
|
|
|
{ ST_staffLineWidth, StyleType("staffLineWidth", ST_SPATIUM) },
|
|
|
|
{ ST_ledgerLineWidth, StyleType("ledgerLineWidth", ST_SPATIUM) },
|
|
|
|
{ ST_ledgerLineLength, StyleType("ledgerLineLength", ST_SPATIUM) },
|
|
|
|
{ ST_accidentalDistance, StyleType("accidentalDistance", ST_SPATIUM) },
|
|
|
|
{ ST_accidentalNoteDistance, StyleType("accidentalNoteDistance", ST_SPATIUM) },
|
2013-07-23 16:43:56 +02:00
|
|
|
{ ST_beamWidth, StyleType("beamWidth", ST_SPATIUM) },
|
|
|
|
{ ST_beamDistance, StyleType("beamDistance", ST_DOUBLE) }, // in beamWidth units
|
|
|
|
{ ST_beamMinLen, StyleType("beamMinLen", ST_SPATIUM) }, // len for broken beams
|
|
|
|
{ ST_dotMag, StyleType("dotMag", ST_DOUBLE) },
|
|
|
|
{ ST_dotNoteDistance, StyleType("dotNoteDistance", ST_SPATIUM) },
|
|
|
|
{ ST_dotRestDistance, StyleType("dotRestDistance", ST_SPATIUM) },
|
|
|
|
{ ST_dotDotDistance, StyleType("dotDotDistance", ST_SPATIUM) },
|
|
|
|
{ ST_propertyDistanceHead, StyleType("propertyDistanceHead", ST_SPATIUM) }, // note property to note head
|
|
|
|
{ ST_propertyDistanceStem, StyleType("propertyDistanceStem", ST_SPATIUM) }, // note property to note stem
|
|
|
|
{ ST_propertyDistance, StyleType("propertyDistance", ST_SPATIUM) }, // note property to note property
|
|
|
|
{ ST_lastSystemFillLimit, StyleType("lastSystemFillLimit", ST_DOUBLE) },
|
|
|
|
{ ST_hairpinY, StyleType("hairpinY", ST_SPATIUM) },
|
|
|
|
{ ST_hairpinHeight, StyleType("hairpinHeight", ST_SPATIUM) },
|
|
|
|
{ ST_hairpinContHeight, StyleType("hairpinContHeight", ST_SPATIUM) },
|
2013-08-09 11:42:24 +02:00
|
|
|
{ ST_hairpinLineWidth, StyleType("hairpinWidth", ST_SPATIUM) },
|
2013-07-23 16:43:56 +02:00
|
|
|
{ ST_pedalY, StyleType("pedalY", ST_SPATIUM) },
|
2013-08-09 11:42:24 +02:00
|
|
|
{ ST_pedalLineWidth, StyleType("pedalLineWidth", ST_SPATIUM) },
|
|
|
|
{ ST_pedalLineStyle, StyleType("pedalListStyle", ST_INT) },
|
2013-07-23 16:43:56 +02:00
|
|
|
{ ST_trillY, StyleType("trillY", ST_SPATIUM) },
|
|
|
|
{ ST_harmonyY, StyleType("harmonyY", ST_SPATIUM) },
|
|
|
|
{ ST_harmonyFretDist, StyleType("harmonyFretDist", ST_SPATIUM) },
|
|
|
|
{ ST_minHarmonyDistance, StyleType("minHarmonyDistance", ST_SPATIUM) },
|
|
|
|
{ ST_showPageNumber, StyleType("showPageNumber", ST_BOOL) },
|
|
|
|
{ ST_showPageNumberOne, StyleType("showPageNumberOne", ST_BOOL) },
|
|
|
|
{ ST_pageNumberOddEven, StyleType("pageNumberOddEven", ST_BOOL) },
|
|
|
|
{ ST_showMeasureNumber, StyleType("showMeasureNumber", ST_BOOL) },
|
|
|
|
{ ST_showMeasureNumberOne, StyleType("showMeasureNumberOne", ST_BOOL) },
|
|
|
|
{ ST_measureNumberInterval, StyleType("measureNumberInterval", ST_INT) },
|
|
|
|
{ ST_measureNumberSystem, StyleType("measureNumberSystem", ST_BOOL) },
|
|
|
|
{ ST_measureNumberAllStaffs, StyleType("measureNumberAllStaffs", ST_BOOL) },
|
|
|
|
{ ST_smallNoteMag, StyleType("smallNoteMag", ST_DOUBLE) },
|
|
|
|
{ ST_graceNoteMag, StyleType("graceNoteMag", ST_DOUBLE) },
|
|
|
|
{ ST_smallStaffMag, StyleType("smallStaffMag", ST_DOUBLE) },
|
|
|
|
{ ST_smallClefMag, StyleType("smallClefMag", ST_DOUBLE) },
|
|
|
|
{ ST_genClef, StyleType("genClef", ST_BOOL) }, // create clef for all systems, not only for first
|
|
|
|
{ ST_genKeysig, StyleType("genKeysig", ST_BOOL) }, // create key signature for all systems
|
|
|
|
{ ST_genTimesig, StyleType("genTimesig", ST_BOOL) },
|
|
|
|
{ ST_genCourtesyTimesig, StyleType("genCourtesyTimesig", ST_BOOL) },
|
|
|
|
{ ST_genCourtesyKeysig, StyleType("genCourtesyKeysig", ST_BOOL) },
|
|
|
|
{ ST_genCourtesyClef, StyleType("genCourtesyClef", ST_BOOL) },
|
|
|
|
{ ST_useStandardNoteNames, StyleType("useStandardNoteNames", ST_BOOL) },
|
|
|
|
{ ST_useGermanNoteNames, StyleType("useGermanNoteNames", ST_BOOL) },
|
|
|
|
{ ST_useSolfeggioNoteNames, StyleType("useSolfeggioNoteNames", ST_BOOL) },
|
|
|
|
{ ST_lowerCaseMinorChords, StyleType("lowerCaseMinorChords", ST_BOOL) },
|
|
|
|
{ ST_chordStyle, StyleType("chordStyle", ST_STRING) },
|
|
|
|
{ ST_chordsXmlFile, StyleType("chordsXmlFile", ST_BOOL) },
|
|
|
|
{ ST_chordDescriptionFile, StyleType("chordDescriptionFile", ST_STRING) },
|
|
|
|
{ ST_concertPitch, StyleType("concertPitch", ST_BOOL) }, // display transposing instruments in concert pitch
|
|
|
|
{ ST_createMultiMeasureRests, StyleType("createMultiMeasureRests", ST_BOOL) },
|
|
|
|
{ ST_minEmptyMeasures, StyleType("minEmptyMeasures", ST_INT) }, // minimum number of empty measures for multi measure rest
|
|
|
|
{ ST_minMMRestWidth, StyleType("minMMRestWidth", ST_SPATIUM) }, // minimum width of multi measure rest
|
|
|
|
{ ST_hideEmptyStaves, StyleType("hideEmptyStaves", ST_BOOL) },
|
|
|
|
{ ST_dontHideStavesInFirstSystem, StyleType("dontHidStavesInFirstSystm", ST_BOOL) },
|
|
|
|
{ ST_gateTime, StyleType("gateTime", ST_INT) }, // 0-100%
|
|
|
|
{ ST_tenutoGateTime, StyleType("tenutoGateTime", ST_INT) },
|
|
|
|
{ ST_staccatoGateTime, StyleType("staccatoGateTime", ST_INT) },
|
|
|
|
{ ST_slurGateTime, StyleType("slurGateTime", ST_INT) },
|
|
|
|
{ ST_ArpeggioNoteDistance, StyleType("ArpeggioNoteDistance", ST_SPATIUM) },
|
|
|
|
{ ST_ArpeggioLineWidth, StyleType("ArpeggioLineWidth", ST_SPATIUM) },
|
|
|
|
{ ST_ArpeggioHookLen, StyleType("ArpeggioHookLen", ST_SPATIUM) },
|
|
|
|
{ ST_FixMeasureNumbers, StyleType("FixMeasureNumbers", ST_INT) },
|
|
|
|
{ ST_FixMeasureWidth, StyleType("FixMeasureWidth", ST_BOOL) },
|
|
|
|
{ ST_SlurEndWidth, StyleType("slurEndWidth", ST_SPATIUM) },
|
|
|
|
{ ST_SlurMidWidth, StyleType("slurMidWidth", ST_SPATIUM) },
|
|
|
|
{ ST_SlurDottedWidth, StyleType("slurDottedWidth", ST_SPATIUM) },
|
|
|
|
{ ST_SectionPause, StyleType("sectionPause", ST_DOUBLE) },
|
|
|
|
{ ST_MusicalSymbolFont, StyleType("musicalSymbolFont", ST_STRING) },
|
|
|
|
{ ST_showHeader, StyleType("showHeader", ST_BOOL) },
|
|
|
|
{ ST_headerStyled, StyleType("headerStyled", ST_BOOL) },
|
|
|
|
{ ST_headerFirstPage, StyleType("headerFirstPage", ST_BOOL) },
|
|
|
|
{ ST_headerOddEven, StyleType("headerOddEven", ST_BOOL) },
|
|
|
|
{ ST_evenHeaderL, StyleType("evenHeaderL", ST_STRING) },
|
|
|
|
{ ST_evenHeaderC, StyleType("evenHeaderC", ST_STRING) },
|
|
|
|
{ ST_evenHeaderR, StyleType("evenHeaderR", ST_STRING) },
|
|
|
|
{ ST_oddHeaderL, StyleType("oddHeaderL", ST_STRING) },
|
|
|
|
{ ST_oddHeaderC, StyleType("oddHeaderC", ST_STRING) },
|
|
|
|
{ ST_oddHeaderR, StyleType("oddHeaderR", ST_STRING) },
|
|
|
|
{ ST_showFooter, StyleType("showFooter", ST_BOOL) },
|
|
|
|
{ ST_footerStyled, StyleType("footerStyled", ST_BOOL) },
|
|
|
|
{ ST_footerFirstPage, StyleType("footerFirstPage", ST_BOOL) },
|
|
|
|
{ ST_footerOddEven, StyleType("footerOddEven", ST_BOOL) },
|
|
|
|
{ ST_evenFooterL, StyleType("evenFooterL", ST_STRING) },
|
|
|
|
{ ST_evenFooterC, StyleType("evenFooterC", ST_STRING) },
|
|
|
|
{ ST_evenFooterR, StyleType("evenFooterR", ST_STRING) },
|
|
|
|
{ ST_oddFooterL, StyleType("oddFooterL", ST_STRING) },
|
|
|
|
{ ST_oddFooterC, StyleType("oddFooterC", ST_STRING) },
|
|
|
|
{ ST_oddFooterR, StyleType("oddFooterR", ST_STRING) },
|
|
|
|
{ ST_voltaY, StyleType("voltaY", ST_SPATIUM) },
|
|
|
|
{ ST_voltaHook, StyleType("voltaHook", ST_SPATIUM) },
|
|
|
|
{ ST_voltaLineWidth, StyleType("voltaLineWidth", ST_SPATIUM) },
|
2013-08-08 11:38:32 +02:00
|
|
|
{ ST_voltaLineStyle, StyleType("voltaLineStyle", ST_INT) },
|
2013-07-23 16:43:56 +02:00
|
|
|
{ ST_ottavaY, StyleType("ottavaY", ST_SPATIUM) },
|
|
|
|
{ ST_ottavaHook, StyleType("ottavaHook", ST_SPATIUM) },
|
|
|
|
{ ST_ottavaLineWidth, StyleType("ottavaLineWidth", ST_SPATIUM) },
|
2013-08-08 11:38:32 +02:00
|
|
|
{ ST_ottavaLineStyle, StyleType("ottavaLineStyle", ST_INT) },
|
2013-08-10 21:02:21 +02:00
|
|
|
{ ST_ottavaNumbersOnly, StyleType("ottavaNumbersOnly", ST_BOOL) },
|
2013-07-23 16:43:56 +02:00
|
|
|
{ ST_tabClef, StyleType("tabClef", ST_INT) },
|
|
|
|
{ ST_tremoloWidth, StyleType("tremoloWidth", ST_SPATIUM) },
|
|
|
|
{ ST_tremoloBoxHeight, StyleType("tremoloBoxHeight", ST_SPATIUM) },
|
|
|
|
{ ST_tremoloStrokeWidth, StyleType("tremoloLineWidth", ST_SPATIUM) },
|
|
|
|
{ ST_tremoloDistance, StyleType("tremoloDistance", ST_SPATIUM) },
|
|
|
|
{ ST_linearStretch, StyleType("linearStretch", ST_DOUBLE) },
|
|
|
|
{ ST_crossMeasureValues, StyleType("crossMeasureValues", ST_BOOL) },
|
|
|
|
{ ST_keySigNaturals, StyleType("keySigNaturals", ST_INT) }
|
|
|
|
};
|
|
|
|
|
|
|
|
class StyleTypes {
|
|
|
|
StyleType st[ST_STYLES];
|
|
|
|
|
|
|
|
public:
|
|
|
|
StyleTypes()
|
|
|
|
{
|
|
|
|
for (auto i : styleTypes2)
|
|
|
|
st[i.idx] = i.val;
|
|
|
|
};
|
|
|
|
const char* name(StyleIdx i) const { return st[i].name(); }
|
|
|
|
StyleValueType valueType(StyleIdx i) const { return st[i].valueType(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const StyleTypes styleTypes;
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
static const QString ff("FreeSerifMscore");
|
|
|
|
|
|
|
|
#define MM(x) ((x)/INCH)
|
|
|
|
#define OA OFFSET_ABS
|
|
|
|
#define OS OFFSET_SPATIUM
|
|
|
|
#define TR(x) QT_TRANSLATE_NOOP("MuseScore", x)
|
|
|
|
#define AS(x) s->addTextStyle(x)
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setDefaultStyle
|
|
|
|
// synchronize with TextStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void initStyle(MStyle* s)
|
|
|
|
{
|
|
|
|
// this is an empty style, no offsets are allowed
|
2013-02-25 00:18:14 +01:00
|
|
|
// never show this style
|
2012-05-26 14:26:10 +02:00
|
|
|
AS(TextStyle(
|
2013-02-25 00:18:14 +01:00
|
|
|
"", ff, 10, false, false, false, ALIGN_LEFT | ALIGN_BASELINE, QPointF(), OS, QPointF(), false,
|
|
|
|
Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, false, QColor(Qt::black),
|
|
|
|
QColor(255, 255, 255, 0), TextStyle::HIDE_ALWAYS));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Title"), ff, 24, false, false, false,
|
2012-10-22 09:51:14 +02:00
|
|
|
ALIGN_HCENTER | ALIGN_TOP, QPointF(), OA, QPointF(50.0, .0)));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Subtitle"), ff, 14, false, false, false,
|
2012-10-22 09:51:14 +02:00
|
|
|
ALIGN_HCENTER | ALIGN_TOP, QPointF(0, MM(10)), OA, QPointF(50.0, .0)));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Composer"), ff, 12, false, false, false,
|
2012-10-22 09:51:14 +02:00
|
|
|
ALIGN_RIGHT | ALIGN_BASELINE, QPointF(MM(-1), MM(-2)), OA, QPointF(100.0, 100.0)));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Lyricist"), ff, 12, false, false, false,
|
2012-10-21 11:25:15 +02:00
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(MM(1), MM(-2)), OA, QPointF(0.0, 100.0)));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Lyrics odd lines"), ff, 11, false, false, false,
|
2012-10-05 10:52:15 +02:00
|
|
|
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, 7), OS, QPointF(), true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Lyrics even lines"), ff, 11, false, false, false,
|
2012-10-05 10:52:15 +02:00
|
|
|
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, 7), OS, QPointF(), true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Fingering"), ff, 8, false, false, false,
|
|
|
|
ALIGN_CENTER, QPointF(), OA, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "InstrumentsLong"), ff, 12, false, false, false,
|
|
|
|
ALIGN_RIGHT | ALIGN_VCENTER, QPointF(), OA, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "InstrumentsShort"), ff, 12, false, false, false,
|
|
|
|
ALIGN_RIGHT | ALIGN_VCENTER, QPointF(), OA, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "InstrumentsExcerpt"), ff, 18, false, false, false,
|
|
|
|
ALIGN_LEFT | ALIGN_TOP, QPointF(), OA, QPointF()));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
2013-08-12 13:15:46 +02:00
|
|
|
TR( "Dynamics"), "Bravura", 12, false,
|
2013-02-12 20:51:17 +01:00
|
|
|
false, // italic?
|
|
|
|
false,
|
2012-05-26 14:26:10 +02:00
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0.0, 8.0), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Technik"), ff, 12, false, true, false,
|
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0.0, -2.0), OS));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Tempo"), ff, 12, false, false, false,
|
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -4.0), OS, QPointF(),
|
2012-09-10 09:57:35 +02:00
|
|
|
true, MMSP(.0), MMSP(.0), 0, Qt::black, false, true));
|
2013-07-23 16:43:56 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Metronome"), ff, 12, true, false, false, ALIGN_LEFT));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Measure Number"), ff, 8, false, false, false,
|
2012-10-16 17:11:35 +02:00
|
|
|
ALIGN_HCENTER | ALIGN_BOTTOM, QPointF(.0, -2.0), OS, QPointF(), true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Translator"), ff, 11, false, false, false,
|
|
|
|
ALIGN_HCENTER | ALIGN_TOP, QPointF(0, 6)));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Tuplets"), ff, 10, false, true, false,
|
|
|
|
ALIGN_CENTER, QPointF(), OA, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "System"), ff, 10, false, false, false,
|
|
|
|
ALIGN_LEFT, QPointF(0, -4.0), OS, QPointF(), true,
|
2012-09-10 09:57:35 +02:00
|
|
|
Spatium(0.0), Spatium(0.0), 25, Qt::black, false, true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Staff"), ff, 10, false, false, false,
|
|
|
|
ALIGN_LEFT, QPointF(0, -4.0), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Chordname"), ff, 12, false, false, false,
|
2013-05-17 20:32:17 +02:00
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(), OS, QPointF(), true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Rehearsal Mark"), ff, 14, true, false, false,
|
|
|
|
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -3.0), OS, QPointF(), true,
|
2012-09-11 21:10:44 +02:00
|
|
|
Spatium(0.2), Spatium(.5), 20, Qt::black, false, true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
2012-10-04 17:07:38 +02:00
|
|
|
TR( "Repeat Text Left"), "MScore", 20, false, false, false,
|
2012-05-26 14:26:10 +02:00
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(), true,
|
2012-09-10 09:57:35 +02:00
|
|
|
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Repeat Text Right"), ff, 12, false, false, false,
|
|
|
|
ALIGN_RIGHT | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(100, 0), true,
|
2012-09-10 09:57:35 +02:00
|
|
|
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Repeat Text"), ff, 12, false, false, false, // for backward compatibility
|
|
|
|
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(100, 0), true,
|
2012-09-10 09:57:35 +02:00
|
|
|
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2012-10-27 11:08:35 +02:00
|
|
|
// y offset may depend on voltaHook style element
|
2012-05-26 14:26:10 +02:00
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Volta"), ff, 11, true, false, false,
|
2012-10-27 11:08:35 +02:00
|
|
|
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0.5, 1.9), OS, QPointF(), true));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Frame"), ff, 12, false, false, false, ALIGN_LEFT | ALIGN_TOP));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "TextLine"), ff, 12, false, false, false,
|
|
|
|
ALIGN_LEFT | ALIGN_VCENTER, QPointF(), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Glissando"), ff, 8, false, true, false,
|
|
|
|
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "String Number"), ff, 8, false, false, false,
|
2012-09-10 09:57:35 +02:00
|
|
|
ALIGN_CENTER, QPointF(0, -5.0), OS, QPointF(100, 0), true,
|
2012-10-04 17:07:38 +02:00
|
|
|
Spatium(0.1), Spatium(0.2), 0, Qt::black, true, false));
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Ottava"), ff, 12, false, true, false,
|
|
|
|
ALIGN_LEFT | ALIGN_VCENTER, QPointF(), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Bend"), ff, 8, false, false, false,
|
|
|
|
ALIGN_CENTER | ALIGN_BOTTOM, QPointF(), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Header"), ff, 8, false, false, false,
|
|
|
|
ALIGN_HCENTER | ALIGN_TOP));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Footer"), ff, 8, false, false, false,
|
|
|
|
ALIGN_HCENTER | ALIGN_BOTTOM, QPointF(0.0, MM(5)), OA));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR( "Instrument Change"), ff, 12, true, false, false,
|
|
|
|
ALIGN_LEFT | ALIGN_BOTTOM, QPointF(0, -3.0), OS, QPointF(0, 0), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Lyrics Verse"), ff, 11, false, false, false,
|
|
|
|
ALIGN_RIGHT | ALIGN_TOP, QPointF(), OS, QPointF(), true));
|
|
|
|
|
|
|
|
AS(TextStyle(
|
|
|
|
TR("Figured Bass"), "MScoreBC", 8, false, false, false,
|
2013-02-25 00:18:14 +01:00
|
|
|
ALIGN_LEFT | ALIGN_TOP, QPointF(0, 6), OS, QPointF(), true,
|
|
|
|
Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, // default params
|
|
|
|
false, QColor(Qt::black), QColor(255, 255, 255, 0), // default params
|
|
|
|
TextStyle::HIDE_IN_EDITOR)); // don't show in Style Editor
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
#undef MM
|
|
|
|
#undef OA
|
|
|
|
#undef OS
|
|
|
|
#undef TR
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// Style
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
StyleData::StyleData()
|
|
|
|
: _values(ST_STYLES)
|
|
|
|
{
|
|
|
|
_customChordList = false;
|
|
|
|
|
2013-07-23 16:43:56 +02:00
|
|
|
struct StyleVal2 {
|
|
|
|
StyleIdx idx;
|
2013-08-09 11:42:24 +02:00
|
|
|
QVariant val;
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
|
|
|
static const StyleVal2 values2[] = {
|
2013-08-10 21:02:21 +02:00
|
|
|
{ ST_staffUpperBorder, 7.0 },
|
|
|
|
{ ST_staffLowerBorder, 7.0 },
|
|
|
|
{ ST_staffDistance, 6.5 },
|
|
|
|
{ ST_akkoladeDistance, 6.5 },
|
|
|
|
{ ST_minSystemDistance, 8.5 },
|
|
|
|
{ ST_maxSystemDistance, 15.0 },
|
|
|
|
{ ST_lyricsDistance, 3.5 },
|
|
|
|
{ ST_lyricsMinBottomDistance, 2 },
|
2013-08-09 11:42:24 +02:00
|
|
|
{ ST_lyricsLineHeight, QVariant(1.0) },
|
|
|
|
{ ST_figuredBassFontFamily, QVariant(QString("MuseScore Figured Bass")) },
|
|
|
|
{ ST_figuredBassFontSize, QVariant(8.0) },
|
|
|
|
{ ST_figuredBassYOffset, QVariant(6.0) },
|
|
|
|
{ ST_figuredBassLineHeight, QVariant(1.0) },
|
|
|
|
{ ST_figuredBassAlignment, QVariant(0) },
|
|
|
|
{ ST_figuredBassStyle, QVariant(0) },
|
|
|
|
{ ST_systemFrameDistance, QVariant(7.0) },
|
|
|
|
{ ST_frameSystemDistance, QVariant(7.0) },
|
|
|
|
{ ST_minMeasureWidth, QVariant(5.0) },
|
|
|
|
{ ST_barWidth, QVariant(0.16) }, // 0.1875
|
|
|
|
{ ST_doubleBarWidth, QVariant(0.16) },
|
|
|
|
{ ST_endBarWidth, QVariant(0.5) }, // 0.5
|
|
|
|
{ ST_doubleBarDistance, QVariant(0.30) },
|
|
|
|
{ ST_endBarDistance, QVariant(0.40) }, // 0.3
|
|
|
|
{ ST_repeatBarTips, QVariant(false) },
|
|
|
|
{ ST_startBarlineSingle, QVariant(false) },
|
|
|
|
{ ST_startBarlineMultiple, QVariant(true) },
|
|
|
|
{ ST_bracketWidth, QVariant(0.45) },
|
|
|
|
{ ST_bracketDistance, QVariant(0.8) },
|
|
|
|
{ ST_akkoladeWidth, QVariant(1.6) },
|
|
|
|
{ ST_akkoladeBarDistance, QVariant(.4) },
|
|
|
|
{ ST_clefLeftMargin, QVariant(0.64) },
|
|
|
|
{ ST_keysigLeftMargin, QVariant(0.5) },
|
|
|
|
{ ST_timesigLeftMargin, QVariant(0.5) },
|
|
|
|
{ ST_clefKeyRightMargin, QVariant(1.75) },
|
|
|
|
{ ST_clefBarlineDistance, QVariant(0.18) }, // was 0.5
|
|
|
|
{ ST_stemWidth, QVariant(0.13) }, // 0.09375
|
|
|
|
{ ST_shortenStem, QVariant(true) },
|
|
|
|
{ ST_shortStemProgression, QVariant(0.25) },
|
|
|
|
{ ST_shortestStem, QVariant(2.25) },
|
|
|
|
{ ST_beginRepeatLeftMargin, QVariant(1.0) },
|
|
|
|
{ ST_minNoteDistance, QVariant(0.25) }, // 0.4
|
|
|
|
{ ST_barNoteDistance, QVariant(1.2) },
|
|
|
|
{ ST_barAccidentalDistance, QVariant(.3) },
|
|
|
|
{ ST_multiMeasureRestMargin, QVariant(1.2) },
|
|
|
|
{ ST_noteBarDistance, QVariant(1.0) },
|
|
|
|
{ ST_measureSpacing, QVariant(1.2) },
|
|
|
|
{ ST_staffLineWidth, QVariant(0.08) }, // 0.09375
|
|
|
|
{ ST_ledgerLineWidth, QVariant(0.12) }, // 0.1875
|
|
|
|
{ ST_ledgerLineLength, QVariant(.6) }, // note head width + this value
|
|
|
|
{ ST_accidentalDistance, QVariant(0.22) },
|
|
|
|
{ ST_accidentalNoteDistance, QVariant(0.22) },
|
|
|
|
{ ST_beamWidth, QVariant(0.5) }, // was 0.48
|
|
|
|
{ ST_beamDistance, QVariant(0.5) }, // 0.25sp
|
|
|
|
{ ST_beamMinLen, QVariant(1.316178) }, // exactly note head width
|
|
|
|
{ ST_dotMag, QVariant(1.0) },
|
|
|
|
{ ST_dotNoteDistance, QVariant(0.35) },
|
|
|
|
{ ST_dotRestDistance, QVariant(0.25) },
|
|
|
|
{ ST_dotDotDistance, QVariant(0.5) },
|
|
|
|
{ ST_propertyDistanceHead, QVariant(1.0) },
|
|
|
|
{ ST_propertyDistanceStem, QVariant(1.8) },
|
|
|
|
{ ST_propertyDistance, QVariant(1.0) },
|
|
|
|
{ ST_lastSystemFillLimit, QVariant(0.3) },
|
|
|
|
{ ST_hairpinY, QVariant(8) },
|
|
|
|
{ ST_hairpinHeight, QVariant(1.2) },
|
|
|
|
{ ST_hairpinContHeight, QVariant(0.5) },
|
|
|
|
{ ST_hairpinLineWidth, QVariant(0.13) },
|
|
|
|
{ ST_pedalY, QVariant(8) },
|
|
|
|
{ ST_pedalLineWidth, QVariant(.15) },
|
|
|
|
{ ST_pedalLineStyle, QVariant(int(Qt::SolidLine)) },
|
|
|
|
{ ST_trillY, QVariant(-1) },
|
|
|
|
{ ST_harmonyY, QVariant(-2.5) },
|
|
|
|
{ ST_harmonyFretDist, QVariant(-1.5) },
|
|
|
|
{ ST_minHarmonyDistance, QVariant(0.5) },
|
|
|
|
{ ST_showPageNumber, QVariant(true) },
|
|
|
|
{ ST_showPageNumberOne, QVariant(false) },
|
|
|
|
{ ST_pageNumberOddEven, QVariant(true) },
|
|
|
|
{ ST_showMeasureNumber, QVariant(true) },
|
|
|
|
{ ST_showMeasureNumberOne, QVariant(false) },
|
|
|
|
{ ST_measureNumberInterval, QVariant(5) },
|
|
|
|
{ ST_measureNumberSystem, QVariant(true) },
|
|
|
|
{ ST_measureNumberAllStaffs, QVariant(false) },
|
|
|
|
{ ST_smallNoteMag, QVariant(qreal(.7)) },
|
|
|
|
{ ST_graceNoteMag, QVariant(qreal(0.7)) },
|
|
|
|
{ ST_smallStaffMag, QVariant(qreal(0.7)) },
|
|
|
|
{ ST_smallClefMag, QVariant(qreal(0.8)) },
|
|
|
|
{ ST_genClef, QVariant(true) },
|
|
|
|
{ ST_genKeysig, QVariant(true) },
|
|
|
|
{ ST_genTimesig, QVariant(true) },
|
|
|
|
{ ST_genCourtesyTimesig, QVariant(true) },
|
|
|
|
{ ST_genCourtesyKeysig, QVariant(true) },
|
|
|
|
{ ST_genCourtesyClef, QVariant(true) },
|
|
|
|
{ ST_useStandardNoteNames, QVariant(true) },
|
|
|
|
{ ST_useGermanNoteNames, QVariant(false) },
|
|
|
|
{ ST_useSolfeggioNoteNames, QVariant(false) },
|
|
|
|
{ ST_lowerCaseMinorChords, QVariant(false) },
|
|
|
|
{ ST_chordStyle, QVariant(QString("std")) },
|
|
|
|
{ ST_chordsXmlFile, QVariant(false) },
|
|
|
|
{ ST_chordDescriptionFile, QVariant(QString("chords_std.xml")) },
|
|
|
|
{ ST_concertPitch, QVariant(false) },
|
|
|
|
{ ST_createMultiMeasureRests, QVariant(false) },
|
|
|
|
{ ST_minEmptyMeasures, QVariant(2) },
|
|
|
|
{ ST_minMMRestWidth, QVariant(4) },
|
|
|
|
{ ST_hideEmptyStaves, QVariant(false) },
|
|
|
|
{ ST_dontHideStavesInFirstSystem, QVariant(true) },
|
|
|
|
{ ST_gateTime, QVariant(100) },
|
|
|
|
{ ST_tenutoGateTime, QVariant(100) },
|
|
|
|
{ ST_staccatoGateTime, QVariant(50) },
|
|
|
|
{ ST_slurGateTime, QVariant(100) },
|
|
|
|
{ ST_ArpeggioNoteDistance, QVariant(.5) },
|
|
|
|
{ ST_ArpeggioLineWidth, QVariant(.18) },
|
|
|
|
{ ST_ArpeggioHookLen, QVariant(.8) },
|
|
|
|
{ ST_FixMeasureNumbers, QVariant(0) },
|
|
|
|
{ ST_FixMeasureWidth, QVariant(false) },
|
|
|
|
{ ST_SlurEndWidth, QVariant(.07) },
|
|
|
|
{ ST_SlurMidWidth, QVariant(.15) },
|
|
|
|
{ ST_SlurDottedWidth, QVariant(.1) },
|
|
|
|
{ ST_SectionPause, QVariant(qreal(3.0)) },
|
|
|
|
{ ST_MusicalSymbolFont, QVariant(QString("Emmentaler")) },
|
|
|
|
{ ST_showHeader, QVariant(false) },
|
|
|
|
{ ST_headerStyled, QVariant(true) },
|
|
|
|
{ ST_headerFirstPage, QVariant(false) },
|
|
|
|
{ ST_headerOddEven, QVariant(true) },
|
|
|
|
{ ST_evenHeaderL, QVariant(QString()) },
|
|
|
|
{ ST_evenHeaderC, QVariant(QString()) },
|
|
|
|
{ ST_evenHeaderR, QVariant(QString()) },
|
|
|
|
{ ST_oddHeaderL, QVariant(QString()) },
|
|
|
|
{ ST_oddHeaderC, QVariant(QString()) },
|
|
|
|
{ ST_oddHeaderR, QVariant(QString()) },
|
|
|
|
{ ST_showFooter, QVariant(true) },
|
|
|
|
{ ST_footerStyled, QVariant(true) },
|
|
|
|
{ ST_footerFirstPage, QVariant(true) },
|
|
|
|
{ ST_footerOddEven, QVariant(true) },
|
|
|
|
{ ST_evenFooterL, QVariant(QString("$p")) },
|
|
|
|
{ ST_evenFooterC, QVariant(QString("$:copyright:")) },
|
|
|
|
{ ST_evenFooterR, QVariant(QString()) },
|
|
|
|
{ ST_oddFooterL, QVariant(QString()) },
|
|
|
|
{ ST_oddFooterC, QVariant(QString("$:copyright:")) },
|
|
|
|
{ ST_oddFooterR, QVariant(QString("$p")) },
|
|
|
|
{ ST_voltaY, QVariant(-3.0) },
|
|
|
|
{ ST_voltaHook, QVariant(1.9) },
|
|
|
|
{ ST_voltaLineWidth, QVariant(.1) },
|
|
|
|
{ ST_voltaLineStyle, QVariant(int(Qt::SolidLine)) },
|
|
|
|
{ ST_ottavaY, QVariant(-3.0) },
|
|
|
|
{ ST_ottavaHook, QVariant(1.9) },
|
|
|
|
{ ST_ottavaLineWidth, QVariant(.1) },
|
|
|
|
{ ST_ottavaLineStyle, QVariant(int(Qt::DashLine)) },
|
2013-08-10 21:02:21 +02:00
|
|
|
{ ST_ottavaNumbersOnly, false },
|
2013-08-09 11:42:24 +02:00
|
|
|
{ ST_tabClef, QVariant(int(CLEF_TAB2)) },
|
|
|
|
{ ST_tremoloWidth, QVariant(1.2) }, // tremolo stroke width: note head width
|
|
|
|
{ ST_tremoloBoxHeight, QVariant(0.65) },
|
|
|
|
{ ST_tremoloStrokeWidth, QVariant(0.35) },
|
|
|
|
{ ST_tremoloDistance, QVariant(0.8) },
|
|
|
|
{ ST_linearStretch, QVariant(qreal(1.5)) },
|
|
|
|
{ ST_crossMeasureValues, QVariant(false) },
|
|
|
|
{ ST_keySigNaturals, QVariant(NAT_NONE) }
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
|
|
|
for (unsigned i = 0; i < sizeof(values2)/sizeof(*values2); ++i)
|
|
|
|
_values[values2[i].idx] = values2[i].val;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
// _textStyles.append(TextStyle(defaultTextStyles[i]));
|
|
|
|
_spatium = SPATIUM20 * MScore::DPI;
|
|
|
|
_articulationAnchor[Articulation_Fermata] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Shortfermata] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Longfermata] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Verylongfermata] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Thumb] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Sforzatoaccent] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Espressivo] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Staccato] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Staccatissimo] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Tenuto] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Portato] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Marcato] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Ouvert] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Plusstop] = A_CHORD;
|
|
|
|
_articulationAnchor[Articulation_Upbow] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Downbow] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Reverseturn] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Turn] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Trill] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Prall] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Mordent] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_PrallPrall] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_PrallMordent] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_UpPrall] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_DownPrall] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_UpMordent] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_DownMordent] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_PrallDown] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_PrallUp] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_LinePrall] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Schleifer] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Snappizzicato] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Tapping] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Slapping] = A_TOP_STAFF;
|
|
|
|
_articulationAnchor[Articulation_Popping] = A_TOP_STAFF;
|
|
|
|
_spatium = SPATIUM20 * MScore::DPI;
|
|
|
|
};
|
|
|
|
|
|
|
|
StyleData::StyleData(const StyleData& s)
|
|
|
|
: QSharedData(s)
|
|
|
|
{
|
2013-06-24 11:03:48 +02:00
|
|
|
_values = s._values;
|
|
|
|
_chordList = s._chordList;
|
2012-05-26 14:26:10 +02:00
|
|
|
_customChordList = s._customChordList;
|
|
|
|
_textStyles = s._textStyles;
|
2012-07-06 14:21:05 +02:00
|
|
|
_pageFormat.copy(s._pageFormat);
|
2012-05-26 14:26:10 +02:00
|
|
|
_spatium = s._spatium;
|
|
|
|
for (int i = 0; i < ARTICULATIONS; ++i)
|
|
|
|
_articulationAnchor[i] = s._articulationAnchor[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// Style
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
StyleData::~StyleData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
TextStyle::TextStyle()
|
|
|
|
{
|
|
|
|
d = new TextStyleData;
|
2013-02-25 00:18:14 +01:00
|
|
|
_hidden = HIDE_NEVER;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
2013-02-25 00:18:14 +01:00
|
|
|
TextStyle::TextStyle(QString _name, QString _family, qreal _size,
|
2012-05-26 14:26:10 +02:00
|
|
|
bool _bold, bool _italic, bool _underline,
|
|
|
|
Align _align,
|
|
|
|
const QPointF& _off, OffsetType _ot, const QPointF& _roff,
|
|
|
|
bool sd,
|
2012-09-10 09:57:35 +02:00
|
|
|
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
2013-02-25 00:18:14 +01:00
|
|
|
QColor fg, QColor bg, Hidden hidden)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
d = new TextStyleData(_name, _family, _size,
|
|
|
|
_bold, _italic, _underline, _align, _off, _ot, _roff,
|
2012-07-20 21:46:31 +02:00
|
|
|
sd, fw, pw, fr, co, _circle, _systemFlag, fg, bg);
|
2013-02-25 00:18:14 +01:00
|
|
|
_hidden = hidden;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TextStyle::TextStyle(const TextStyle& s)
|
|
|
|
: d(s.d)
|
|
|
|
{
|
2013-02-25 00:18:14 +01:00
|
|
|
_hidden = s._hidden;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
TextStyle::~TextStyle()
|
|
|
|
{
|
|
|
|
}
|
2012-09-10 09:57:35 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle::operator=
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
TextStyle& TextStyle::operator=(const TextStyle& s)
|
|
|
|
{
|
|
|
|
d = s.d;
|
2013-02-25 00:18:14 +01:00
|
|
|
// _hidden = s._hidden;
|
2012-05-26 14:26:10 +02:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyleData
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
TextStyleData::TextStyleData()
|
|
|
|
{
|
|
|
|
family = "FreeSerif";
|
|
|
|
size = 10.0;
|
|
|
|
bold = false;
|
|
|
|
italic = false;
|
|
|
|
underline = false;
|
|
|
|
hasFrame = false;
|
|
|
|
sizeIsSpatiumDependent = false;
|
2012-09-10 09:57:35 +02:00
|
|
|
frameWidth = Spatium(0);
|
|
|
|
paddingWidth = Spatium(0);
|
|
|
|
frameWidthMM = 0.0;
|
|
|
|
paddingWidthMM = 0.0;
|
2012-05-26 14:26:10 +02:00
|
|
|
frameRound = 25;
|
|
|
|
frameColor = MScore::defaultColor;
|
|
|
|
circle = false;
|
|
|
|
systemFlag = false;
|
|
|
|
foregroundColor = Qt::black;
|
2012-07-20 21:46:31 +02:00
|
|
|
backgroundColor = QColor(255, 255, 255, 0);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TextStyleData::TextStyleData(
|
|
|
|
QString _name, QString _family, qreal _size,
|
|
|
|
bool _bold, bool _italic, bool _underline,
|
|
|
|
Align _align,
|
|
|
|
const QPointF& _off, OffsetType _ot, const QPointF& _roff,
|
|
|
|
bool sd,
|
2012-09-10 09:57:35 +02:00
|
|
|
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
2012-07-20 21:46:31 +02:00
|
|
|
QColor fg, QColor bg)
|
2012-05-26 14:26:10 +02:00
|
|
|
:
|
|
|
|
ElementLayout(_align, _off, _ot, _roff),
|
|
|
|
name(_name), size(_size), bold(_bold),
|
|
|
|
italic(_italic), underline(_underline),
|
|
|
|
sizeIsSpatiumDependent(sd), frameWidth(fw), paddingWidth(pw),
|
|
|
|
frameRound(fr), frameColor(co), circle(_circle), systemFlag(_systemFlag),
|
2012-07-20 21:46:31 +02:00
|
|
|
foregroundColor(fg), backgroundColor(bg)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2012-09-11 21:10:44 +02:00
|
|
|
hasFrame = (fw.val() != 0.0) || (bg.alpha() != 0);
|
|
|
|
family = _family;
|
|
|
|
frameWidthMM = 0.0;
|
|
|
|
paddingWidthMM = 0.0;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// operator!=
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
bool TextStyleData::operator!=(const TextStyleData& s) const
|
|
|
|
{
|
|
|
|
return s.name != name
|
|
|
|
|| s.family != family
|
|
|
|
|| s.size != size
|
|
|
|
|| s.bold != bold
|
|
|
|
|| s.italic != italic
|
|
|
|
|| s.underline != underline
|
|
|
|
|| s.hasFrame != hasFrame
|
|
|
|
|| s.sizeIsSpatiumDependent != sizeIsSpatiumDependent
|
|
|
|
|| s.frameWidth != frameWidth
|
|
|
|
|| s.paddingWidth != paddingWidth
|
|
|
|
|| s.frameRound != frameRound
|
|
|
|
|| s.frameColor != frameColor
|
|
|
|
|| s.circle != circle
|
|
|
|
|| s.systemFlag != systemFlag
|
|
|
|
|| s.foregroundColor != foregroundColor
|
2012-07-20 21:46:31 +02:00
|
|
|
|| s.backgroundColor != backgroundColor
|
2012-05-26 14:26:10 +02:00
|
|
|
|| s.align() != align()
|
|
|
|
|| s.offset() != offset()
|
|
|
|
|| s.rxoff() != rxoff()
|
|
|
|
|| s.ryoff() != ryoff()
|
|
|
|
|| s.offsetType() != offsetType()
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// font
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
QFont TextStyleData::font(qreal _spatium) const
|
|
|
|
{
|
|
|
|
qreal m = size;
|
|
|
|
|
|
|
|
QFont f(family);
|
|
|
|
f.setBold(bold);
|
|
|
|
f.setItalic(italic);
|
|
|
|
f.setUnderline(underline);
|
|
|
|
|
|
|
|
if (sizeIsSpatiumDependent)
|
|
|
|
m *= _spatium / ( SPATIUM20 * MScore::DPI);
|
|
|
|
|
|
|
|
f.setPointSizeF(m);
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// font
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
QFont TextStyleData::fontPx(qreal _spatium) const
|
|
|
|
{
|
|
|
|
qreal m = size * MScore::DPI / PPI;
|
|
|
|
|
|
|
|
QFont f(family);
|
|
|
|
f.setBold(bold);
|
|
|
|
f.setItalic(italic);
|
|
|
|
f.setUnderline(underline);
|
|
|
|
#ifdef USE_GLYPHS
|
|
|
|
f.setHintingPreference(QFont::PreferVerticalHinting);
|
|
|
|
#endif
|
|
|
|
if (sizeIsSpatiumDependent)
|
|
|
|
m *= _spatium / (SPATIUM20 * MScore::DPI);
|
|
|
|
|
|
|
|
f.setPixelSize(lrint(m));
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// write
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void TextStyleData::write(Xml& xml) const
|
|
|
|
{
|
|
|
|
xml.stag("TextStyle");
|
|
|
|
writeProperties(xml);
|
|
|
|
xml.etag();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// writeProperties
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void TextStyleData::writeProperties(Xml& xml) const
|
|
|
|
{
|
|
|
|
ElementLayout::writeProperties(xml);
|
|
|
|
if (!name.isEmpty())
|
|
|
|
xml.tag("name", name);
|
|
|
|
xml.tag("family", family);
|
|
|
|
xml.tag("size", size);
|
|
|
|
if (bold)
|
|
|
|
xml.tag("bold", bold);
|
|
|
|
if (italic)
|
|
|
|
xml.tag("italic", italic);
|
|
|
|
if (underline)
|
|
|
|
xml.tag("underline", underline);
|
|
|
|
if (sizeIsSpatiumDependent)
|
|
|
|
xml.tag("sizeIsSpatiumDependent", sizeIsSpatiumDependent);
|
|
|
|
if (foregroundColor != Qt::black)
|
|
|
|
xml.tag("foregroundColor", foregroundColor);
|
2012-07-20 21:46:31 +02:00
|
|
|
if (backgroundColor != QColor(255, 255, 255, 0))
|
|
|
|
xml.tag("backgroundColor", backgroundColor);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
if (hasFrame) {
|
2012-09-10 09:57:35 +02:00
|
|
|
xml.tag("frameWidthS", frameWidth.val());
|
|
|
|
xml.tag("paddingWidthS", paddingWidth.val());
|
|
|
|
xml.tag("frameRound", frameRound);
|
|
|
|
xml.tag("frameColor", frameColor);
|
2012-05-26 14:26:10 +02:00
|
|
|
if (circle)
|
|
|
|
xml.tag("circle", circle);
|
|
|
|
}
|
|
|
|
if (systemFlag)
|
|
|
|
xml.tag("systemFlag", systemFlag);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// read
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
void TextStyleData::read(XmlReader& e)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2012-09-10 09:57:35 +02:00
|
|
|
frameWidth = Spatium(0.0);
|
2013-01-11 18:10:18 +01:00
|
|
|
name = e.attribute("name");
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
while (e.readNextStartElement()) {
|
2012-05-26 14:26:10 +02:00
|
|
|
if (!readProperties(e))
|
2013-01-11 18:10:18 +01:00
|
|
|
e.unknown();
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// readProperties
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
bool TextStyleData::readProperties(XmlReader& e)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-01-11 18:10:18 +01:00
|
|
|
const QStringRef& tag(e.name());
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
if (tag == "name")
|
2013-01-11 18:10:18 +01:00
|
|
|
name = e.readElementText();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "family")
|
2013-01-11 18:10:18 +01:00
|
|
|
family = e.readElementText();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "size")
|
2013-01-11 18:10:18 +01:00
|
|
|
size = e.readDouble();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "bold")
|
2013-01-11 18:10:18 +01:00
|
|
|
bold = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "italic")
|
2013-01-11 18:10:18 +01:00
|
|
|
italic = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "underline")
|
2013-01-11 18:10:18 +01:00
|
|
|
underline = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "align")
|
2013-01-11 18:10:18 +01:00
|
|
|
setAlign(Align(e.readInt()));
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "anchor") // obsolete
|
2013-01-11 18:10:18 +01:00
|
|
|
e.skipCurrentElement();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (ElementLayout::readProperties(e))
|
|
|
|
;
|
2013-01-23 14:14:09 +01:00
|
|
|
else if (tag == "sizeIsSpatiumDependent" || tag == "spatiumSizeDependent")
|
|
|
|
sizeIsSpatiumDependent = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "frameWidth") {
|
2012-07-22 17:11:36 +02:00
|
|
|
hasFrame = true;
|
2013-01-11 18:10:18 +01:00
|
|
|
frameWidthMM = e.readDouble();
|
2012-09-10 09:57:35 +02:00
|
|
|
}
|
|
|
|
else if (tag == "frameWidthS") {
|
|
|
|
hasFrame = true;
|
2013-01-11 18:10:18 +01:00
|
|
|
frameWidth = Spatium(e.readDouble());
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
2012-07-22 17:11:36 +02:00
|
|
|
else if (tag == "frame") // obsolete
|
2013-01-11 18:10:18 +01:00
|
|
|
hasFrame = e.readInt();
|
2012-09-10 09:57:35 +02:00
|
|
|
else if (tag == "paddingWidth") // obsolete
|
2013-01-11 18:10:18 +01:00
|
|
|
paddingWidthMM = e.readDouble();
|
2012-09-10 09:57:35 +02:00
|
|
|
else if (tag == "paddingWidthS")
|
2013-01-11 18:10:18 +01:00
|
|
|
paddingWidth = Spatium(e.readDouble());
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "frameRound")
|
2013-01-11 18:10:18 +01:00
|
|
|
frameRound = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "frameColor")
|
2013-01-11 18:10:18 +01:00
|
|
|
frameColor = e.readColor();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "foregroundColor")
|
2013-01-11 18:10:18 +01:00
|
|
|
foregroundColor = e.readColor();
|
2012-07-20 21:46:31 +02:00
|
|
|
else if (tag == "backgroundColor")
|
2013-01-11 18:10:18 +01:00
|
|
|
backgroundColor = e.readColor();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "circle")
|
2013-01-11 18:10:18 +01:00
|
|
|
circle = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "systemFlag")
|
2013-01-11 18:10:18 +01:00
|
|
|
systemFlag = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// load
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
void StyleData::load(XmlReader& e)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-06-10 07:03:57 +02:00
|
|
|
QString oldChordDescriptionFile = value(ST_chordDescriptionFile).toString();
|
2013-06-11 20:26:16 +02:00
|
|
|
bool chordListTag = false;
|
2013-01-11 18:10:18 +01:00
|
|
|
while (e.readNextStartElement()) {
|
|
|
|
QString tag = e.name().toString();
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
if (tag == "TextStyle") {
|
|
|
|
TextStyle s;
|
|
|
|
s.read(e);
|
|
|
|
setTextStyle(s);
|
|
|
|
}
|
|
|
|
else if (tag == "Spatium")
|
2013-01-11 18:10:18 +01:00
|
|
|
setSpatium (e.readDouble() * MScore::DPMM);
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "page-layout")
|
|
|
|
_pageFormat.read(e);
|
|
|
|
else if (tag == "displayInConcertPitch")
|
2013-08-09 11:42:24 +02:00
|
|
|
set(ST_concertPitch, QVariant(bool(e.readInt())));
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "ChordList") {
|
2013-06-24 11:03:48 +02:00
|
|
|
_chordList.clear();
|
|
|
|
_chordList.read(e);
|
2012-05-26 14:26:10 +02:00
|
|
|
_customChordList = true;
|
2013-06-11 20:26:16 +02:00
|
|
|
chordListTag = true;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
2013-01-11 18:10:18 +01:00
|
|
|
else if (tag == "pageFillLimit") // obsolete
|
|
|
|
e.skipCurrentElement();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "systemDistance") // obsolete
|
2013-08-09 11:42:24 +02:00
|
|
|
set(ST_minSystemDistance, QVariant(e.readDouble()));
|
2012-05-26 14:26:10 +02:00
|
|
|
else {
|
|
|
|
if (tag == "stemDir") {
|
|
|
|
int voice = e.attribute("voice", "1").toInt() - 1;
|
|
|
|
switch(voice) {
|
|
|
|
case 0: tag = "StemDir1"; break;
|
|
|
|
case 1: tag = "StemDir2"; break;
|
|
|
|
case 2: tag = "StemDir3"; break;
|
|
|
|
case 3: tag = "StemDir4"; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// for compatibility:
|
|
|
|
if (tag == "oddHeader" || tag == "evenHeader"
|
|
|
|
|| tag == "oddFooter" || tag == "evenFooter")
|
|
|
|
tag += "C";
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
QString val(e.readElementText());
|
2013-07-23 16:43:56 +02:00
|
|
|
|
|
|
|
StyleIdx idx;
|
|
|
|
for (int i = 0; i < ST_STYLES; ++i) {
|
|
|
|
idx = static_cast<StyleIdx>(i);
|
|
|
|
if (styleTypes.name(idx) == tag) {
|
|
|
|
switch(styleTypes.valueType(idx)) {
|
2013-08-09 11:42:24 +02:00
|
|
|
case ST_SPATIUM: set(idx, QVariant(val.toDouble())); break;
|
|
|
|
case ST_DOUBLE: set(idx, QVariant(val.toDouble())); break;
|
|
|
|
case ST_BOOL: set(idx, QVariant(bool(val.toInt()))); break;
|
|
|
|
case ST_INT: set(idx, QVariant(val.toInt())); break;
|
|
|
|
case ST_DIRECTION: set(idx, QVariant(MScore::Direction(val.toInt()))); break;
|
|
|
|
case ST_STRING: set(idx, QVariant(val)); break;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (idx >= ST_STYLES) {
|
|
|
|
if (tag == "oddHeader")
|
|
|
|
;
|
|
|
|
else if (tag == "evenHeader")
|
|
|
|
;
|
|
|
|
else if (tag == "oddFooter")
|
|
|
|
;
|
|
|
|
else if (tag == "evenHeader")
|
|
|
|
;
|
|
|
|
else {
|
|
|
|
int idx2;
|
|
|
|
for (idx2 = 0; idx2 < ARTICULATIONS; ++idx2) {
|
|
|
|
ArticulationInfo& ai = Articulation::articulationList[idx2];
|
2013-01-23 14:14:09 +01:00
|
|
|
if (tag == ai.name + "Anchor"
|
|
|
|
|| (tag == "U" + ai.name + "Anchor")
|
|
|
|
|| (tag == "D" + ai.name + "Anchor")
|
|
|
|
) {
|
2012-05-26 14:26:10 +02:00
|
|
|
_articulationAnchor[idx2] = ArticulationAnchor(val.toInt());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (idx2 == ARTICULATIONS)
|
2013-01-11 18:10:18 +01:00
|
|
|
e.unknown();
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-10 07:03:57 +02:00
|
|
|
|
2013-06-11 20:26:16 +02:00
|
|
|
// if we just specified a new chord description file
|
|
|
|
// and didn't encounter a ChordList tag
|
|
|
|
// then load the chord description file
|
2013-06-10 07:03:57 +02:00
|
|
|
QString newChordDescriptionFile = value(ST_chordDescriptionFile).toString();
|
2013-06-11 20:26:16 +02:00
|
|
|
if (newChordDescriptionFile != oldChordDescriptionFile && !chordListTag) {
|
2013-06-10 23:36:35 +02:00
|
|
|
if (!newChordDescriptionFile.startsWith("chords_") && value(ST_chordStyle).toString() == "std") {
|
2013-06-29 01:13:33 +02:00
|
|
|
// should not normally happen,
|
|
|
|
// but treat as "old" (114) score just in case
|
2013-08-09 11:42:24 +02:00
|
|
|
set(ST_chordStyle, QVariant(QString("custom")));
|
|
|
|
set(ST_chordsXmlFile, QVariant(true));
|
2013-06-29 01:13:33 +02:00
|
|
|
qDebug("StyleData::load: custom chord description file %s with chordStyle == std", qPrintable(newChordDescriptionFile));
|
2013-06-10 23:36:35 +02:00
|
|
|
}
|
2013-06-11 20:26:16 +02:00
|
|
|
if (value(ST_chordStyle).toString() == "custom")
|
|
|
|
_customChordList = true;
|
|
|
|
else
|
|
|
|
_customChordList = false;
|
2013-06-30 23:34:41 +02:00
|
|
|
_chordList.unload();
|
2013-06-26 17:19:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// make sure we have a chordlist
|
2013-06-30 23:34:41 +02:00
|
|
|
if (!_chordList.loaded() && !chordListTag) {
|
2013-06-10 07:03:57 +02:00
|
|
|
if (value(ST_chordsXmlFile).toBool())
|
2013-06-24 11:03:48 +02:00
|
|
|
_chordList.read("chords.xml");
|
|
|
|
_chordList.read(newChordDescriptionFile);
|
2013-06-10 07:03:57 +02:00
|
|
|
}
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
//
|
|
|
|
// Compatibility with old scores/styles:
|
|
|
|
// translate old frameWidthMM and paddingWidthMM
|
|
|
|
// into spatium units
|
|
|
|
//
|
|
|
|
int n = _textStyles.size();
|
|
|
|
qreal spMM = _spatium / MScore::DPMM;
|
|
|
|
for (int i = 0; i < n; ++i) {
|
|
|
|
TextStyle* s = &_textStyles[i];
|
|
|
|
if (s->frameWidthMM() != 0.0)
|
|
|
|
s->setFrameWidth(Spatium(s->frameWidthMM() / spMM));
|
|
|
|
if (s->paddingWidthMM() != 0.0)
|
|
|
|
s->setPaddingWidth(Spatium(s->paddingWidthMM() / spMM));
|
|
|
|
}
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// isDefault
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
bool StyleData::isDefault(StyleIdx idx) const
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
return _values[idx] == MScore::baseStyle()->value(idx);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// save
|
|
|
|
// if optimize is true, save only if different to default
|
|
|
|
// style
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void StyleData::save(Xml& xml, bool optimize) const
|
|
|
|
{
|
|
|
|
xml.stag("Style");
|
|
|
|
|
|
|
|
for (int i = 0; i < ST_STYLES; ++i) {
|
|
|
|
StyleIdx idx = StyleIdx(i);
|
|
|
|
if (optimize && isDefault(idx))
|
|
|
|
continue;
|
2013-07-23 16:43:56 +02:00
|
|
|
switch(styleTypes.valueType(idx)) {
|
2012-05-26 14:26:10 +02:00
|
|
|
case ST_SPATIUM:
|
2013-07-23 16:43:56 +02:00
|
|
|
case ST_DOUBLE: xml.tag(styleTypes.name(idx), value(idx).toDouble()); break;
|
|
|
|
case ST_BOOL: xml.tag(styleTypes.name(idx), value(idx).toBool()); break;
|
|
|
|
case ST_INT: xml.tag(styleTypes.name(idx), value(idx).toInt()); break;
|
2013-08-09 11:42:24 +02:00
|
|
|
case ST_DIRECTION: xml.tag(styleTypes.name(idx), value(idx).toInt()); break;
|
2013-07-23 16:43:56 +02:00
|
|
|
case ST_STRING: xml.tag(styleTypes.name(idx), value(idx).toString()); break;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < TEXT_STYLES; ++i) {
|
|
|
|
if (!optimize || _textStyles[i] != MScore::defaultStyle()->textStyle(i))
|
|
|
|
_textStyles[i].write(xml);
|
|
|
|
}
|
|
|
|
for (int i = TEXT_STYLES; i < _textStyles.size(); ++i)
|
|
|
|
_textStyles[i].write(xml);
|
2013-06-24 11:03:48 +02:00
|
|
|
if (_customChordList && !_chordList.isEmpty()) {
|
2012-05-26 14:26:10 +02:00
|
|
|
xml.stag("ChordList");
|
2013-06-24 11:03:48 +02:00
|
|
|
_chordList.write(xml);
|
2012-05-26 14:26:10 +02:00
|
|
|
xml.etag();
|
|
|
|
}
|
|
|
|
for (int i = 0; i < ARTICULATIONS; ++i) {
|
|
|
|
if (optimize && _articulationAnchor[i] == MScore::defaultStyle()->articulationAnchor(i))
|
|
|
|
continue;
|
|
|
|
const ArticulationInfo& ai = Articulation::articulationList[i];
|
|
|
|
xml.tag(ai.name + "Anchor", int(_articulationAnchor[i]));
|
|
|
|
}
|
|
|
|
_pageFormat.write(xml);
|
|
|
|
xml.tag("Spatium", _spatium / MScore::DPMM);
|
|
|
|
xml.etag();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// chordDescription
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const ChordDescription* StyleData::chordDescription(int id) const
|
|
|
|
{
|
2013-06-24 11:03:48 +02:00
|
|
|
return _chordList.value(id);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// chordList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-06-24 11:03:48 +02:00
|
|
|
ChordList* StyleData::chordList()
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-06-24 11:03:48 +02:00
|
|
|
return &_chordList;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setChordList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-06-11 20:26:16 +02:00
|
|
|
void StyleData::setChordList(ChordList* cl, bool custom)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-06-24 11:03:48 +02:00
|
|
|
_chordList = *cl;
|
2013-06-11 20:26:16 +02:00
|
|
|
_customChordList = custom;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const TextStyle& StyleData::textStyle(int idx) const
|
|
|
|
{
|
|
|
|
Q_ASSERT(idx >= 0 && idx < _textStyles.count());
|
|
|
|
return _textStyles[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// value
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-08-09 11:42:24 +02:00
|
|
|
QVariant MStyle::value(StyleIdx idx) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
return d->_values[idx];
|
|
|
|
}
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// isDefault
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
bool MStyle::isDefault(StyleIdx idx) const
|
|
|
|
{
|
|
|
|
return d->isDefault(idx);
|
|
|
|
}
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// chordDescription
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
const ChordDescription* MStyle::chordDescription(int id) const
|
|
|
|
{
|
|
|
|
return d->chordDescription(id);
|
|
|
|
}
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// chordList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-06-24 11:03:48 +02:00
|
|
|
ChordList* MStyle::chordList()
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
return d->chordList();
|
|
|
|
}
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// setChordList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-06-11 20:26:16 +02:00
|
|
|
void MStyle::setChordList(ChordList* cl, bool custom)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-06-11 20:26:16 +02:00
|
|
|
d->setChordList(cl, custom);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const TextStyle& StyleData::textStyle(const QString& name) const
|
|
|
|
{
|
|
|
|
foreach(const TextStyle& s, _textStyles) {
|
|
|
|
if (s.name() == name)
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
qDebug("TextStyle <%s> not found", qPrintable(name));
|
|
|
|
abort();
|
|
|
|
return _textStyles[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
int StyleData::textStyleType(const QString& name) const
|
|
|
|
{
|
|
|
|
for (int i = 0; i < _textStyles.size(); ++i) {
|
|
|
|
if (_textStyles[i].name() == name)
|
|
|
|
return i;
|
|
|
|
}
|
2013-02-12 20:51:17 +01:00
|
|
|
if (name == "Dynamics2")
|
|
|
|
return TEXT_STYLE_DYNAMICS;
|
2012-05-26 14:26:10 +02:00
|
|
|
qDebug("TextStyleType <%s> not found", qPrintable(name));
|
|
|
|
return TEXT_STYLE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void StyleData::setTextStyle(const TextStyle& ts)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < _textStyles.size(); ++i) {
|
|
|
|
if (_textStyles[i].name() == ts.name()) {
|
|
|
|
_textStyles[i] = ts;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_textStyles.append(ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-09-10 09:57:35 +02:00
|
|
|
// TextStyle method wrappers
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2012-09-10 09:57:35 +02:00
|
|
|
QString TextStyle::name() const { return d->name; }
|
|
|
|
QString TextStyle::family() const { return d->family; }
|
|
|
|
qreal TextStyle::size() const { return d->size; }
|
|
|
|
bool TextStyle::bold() const { return d->bold; }
|
|
|
|
bool TextStyle::italic() const { return d->italic; }
|
|
|
|
bool TextStyle::underline() const { return d->underline; }
|
|
|
|
bool TextStyle::hasFrame() const { return d->hasFrame; }
|
|
|
|
Align TextStyle::align() const { return d->align(); }
|
|
|
|
const QPointF& TextStyle::offset() const { return d->offset(); }
|
|
|
|
QPointF TextStyle::offset(qreal spatium) const { return d->offset(spatium); }
|
2012-05-26 14:26:10 +02:00
|
|
|
OffsetType TextStyle::offsetType() const { return d->offsetType(); }
|
|
|
|
bool TextStyle::sizeIsSpatiumDependent() const { return d->sizeIsSpatiumDependent; }
|
2012-09-10 09:57:35 +02:00
|
|
|
|
|
|
|
Spatium TextStyle::frameWidth() const { return d->frameWidth; }
|
|
|
|
Spatium TextStyle::paddingWidth() const { return d->paddingWidth; }
|
|
|
|
qreal TextStyle::frameWidthMM() const { return d->frameWidthMM; }
|
|
|
|
qreal TextStyle::paddingWidthMM() const { return d->paddingWidthMM; }
|
|
|
|
void TextStyle::setFrameWidth(Spatium v) { d->frameWidth = v; }
|
|
|
|
void TextStyle::setPaddingWidth(Spatium v) { d->paddingWidth = v; }
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
int TextStyle::frameRound() const { return d->frameRound; }
|
|
|
|
QColor TextStyle::frameColor() const { return d->frameColor; }
|
|
|
|
bool TextStyle::circle() const { return d->circle; }
|
|
|
|
bool TextStyle::systemFlag() const { return d->systemFlag; }
|
|
|
|
QColor TextStyle::foregroundColor() const { return d->foregroundColor; }
|
2012-07-20 21:46:31 +02:00
|
|
|
QColor TextStyle::backgroundColor() const { return d->backgroundColor; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void TextStyle::setName(const QString& s) { d->name = s; }
|
|
|
|
void TextStyle::setFamily(const QString& s) { d->family = s; }
|
|
|
|
void TextStyle::setSize(qreal v) { d->size = v; }
|
|
|
|
void TextStyle::setBold(bool v) { d->bold = v; }
|
|
|
|
void TextStyle::setItalic(bool v) { d->italic = v; }
|
|
|
|
void TextStyle::setUnderline(bool v) { d->underline = v; }
|
|
|
|
void TextStyle::setHasFrame(bool v) { d->hasFrame = v; }
|
|
|
|
void TextStyle::setAlign(Align v) { d->setAlign(v); }
|
|
|
|
void TextStyle::setXoff(qreal v) { d->setXoff(v); }
|
|
|
|
void TextStyle::setYoff(qreal v) { d->setYoff(v); }
|
|
|
|
void TextStyle::setOffsetType(OffsetType v) { d->setOffsetType(v); }
|
|
|
|
void TextStyle::setRxoff(qreal v) { d->setRxoff(v); }
|
|
|
|
void TextStyle::setRyoff(qreal v) { d->setRyoff(v); }
|
|
|
|
void TextStyle::setSizeIsSpatiumDependent(bool v) { d->sizeIsSpatiumDependent = v; }
|
|
|
|
void TextStyle::setFrameRound(int v) { d->frameRound = v; }
|
|
|
|
void TextStyle::setFrameColor(const QColor& v) { d->frameColor = v; }
|
|
|
|
void TextStyle::setCircle(bool v) { d->circle = v; }
|
|
|
|
void TextStyle::setSystemFlag(bool v) { d->systemFlag = v; }
|
|
|
|
void TextStyle::setForegroundColor(const QColor& v) { d->foregroundColor = v; }
|
2012-07-20 21:46:31 +02:00
|
|
|
void TextStyle::setBackgroundColor(const QColor& v) { d->backgroundColor = v; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void TextStyle::write(Xml& xml) const { d->write(xml); }
|
2013-01-11 18:10:18 +01:00
|
|
|
void TextStyle::read(XmlReader& v) { d->read(v); }
|
2012-05-26 14:26:10 +02:00
|
|
|
QFont TextStyle::font(qreal space) const { return d->font(space); }
|
|
|
|
QFont TextStyle::fontPx(qreal spatium) const { return d->fontPx(spatium); }
|
|
|
|
QRectF TextStyle::bbox(qreal sp, const QString& s) const { return d->bbox(sp, s); }
|
|
|
|
QFontMetricsF TextStyle::fontMetrics(qreal space) const { return d->fontMetrics(space); }
|
|
|
|
bool TextStyle::operator!=(const TextStyle& s) const { return d->operator!=(*s.d); }
|
2012-09-10 09:57:35 +02:00
|
|
|
void TextStyle::layout(Element* e) const { d->layout(e); }
|
|
|
|
void TextStyle::writeProperties(Xml& xml) const { d->writeProperties(xml); }
|
|
|
|
const QPointF& TextStyle::reloff() const { return d->reloff(); }
|
|
|
|
void TextStyle::setReloff(const QPointF& p) { setRxoff(p.x()), setRyoff(p.y()); }
|
2013-01-11 18:10:18 +01:00
|
|
|
bool TextStyle::readProperties(XmlReader& v) { return d->readProperties(v); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setFont
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void TextStyle::setFont(const QFont&)
|
|
|
|
{
|
|
|
|
//TODOxx
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// MStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
MStyle::MStyle()
|
|
|
|
{
|
|
|
|
d = new StyleData;
|
|
|
|
}
|
|
|
|
|
|
|
|
MStyle::MStyle(const MStyle& s)
|
|
|
|
: d(s.d)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MStyle::~MStyle()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MStyle& MStyle::operator=(const MStyle& s)
|
|
|
|
{
|
|
|
|
d = s.d;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// set
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-08-09 11:42:24 +02:00
|
|
|
void MStyle::set(StyleIdx id, const QVariant& v)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-07-23 16:43:56 +02:00
|
|
|
d->_values[id] = v;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const TextStyle& MStyle::textStyle(int idx) const
|
|
|
|
{
|
|
|
|
return d->textStyle(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TextStyle& MStyle::textStyle(const QString& name) const
|
|
|
|
{
|
|
|
|
return d->textStyle(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
int MStyle::textStyleType(const QString& name) const
|
|
|
|
{
|
|
|
|
return d->textStyleType(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::setTextStyle(const TextStyle& ts)
|
|
|
|
{
|
|
|
|
d->setTextStyle(ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// addTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::addTextStyle(const TextStyle& ts)
|
|
|
|
{
|
|
|
|
d->_textStyles.append(ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// removeTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::removeTextStyle(const TextStyle& /*ts*/)
|
|
|
|
{
|
|
|
|
// TODO: d->_textStyles.append(ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyles
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const QList<TextStyle>& MStyle::textStyles() const
|
|
|
|
{
|
|
|
|
return d->_textStyles;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// set
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::set(StyleIdx t, Spatium val)
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val.val()));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MStyle::set(StyleIdx t, const QString& val)
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MStyle::set(StyleIdx t, bool val)
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MStyle::set(StyleIdx t, qreal val)
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MStyle::set(StyleIdx t, int val)
|
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
2012-08-04 15:46:43 +02:00
|
|
|
void MStyle::set(StyleIdx t, MScore::Direction val)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-08-09 11:42:24 +02:00
|
|
|
set(t, QVariant(val));
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// load
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
bool MStyle::load(QFile* qf)
|
|
|
|
{
|
|
|
|
return d->load(qf);
|
|
|
|
}
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
void MStyle::load(XmlReader& e)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
d->load(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// save
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::save(Xml& xml, bool optimize)
|
|
|
|
{
|
|
|
|
d->save(xml, optimize);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// load
|
|
|
|
// return true on success
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
bool StyleData::load(QFile* qf)
|
|
|
|
{
|
2013-01-11 18:10:18 +01:00
|
|
|
XmlReader e(qf);
|
|
|
|
while (e.readNextStartElement()) {
|
|
|
|
if (e.name() == "museScore") {
|
|
|
|
QString version = e.attribute("version");
|
2012-05-26 14:26:10 +02:00
|
|
|
QStringList sl = version.split('.');
|
|
|
|
// _mscVersion = sl[0].toInt() * 100 + sl[1].toInt();
|
2013-01-11 18:10:18 +01:00
|
|
|
while (e.readNextStartElement()) {
|
|
|
|
if (e.name() == "Style")
|
|
|
|
load(e);
|
2012-05-26 14:26:10 +02:00
|
|
|
else
|
2013-01-11 18:10:18 +01:00
|
|
|
e.unknown();
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// pageFormat
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const PageFormat* MStyle::pageFormat() const
|
|
|
|
{
|
|
|
|
return d->pageFormat();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setPageFormat
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::setPageFormat(const PageFormat& pf)
|
|
|
|
{
|
|
|
|
d->setPageFormat(pf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StyleData::setPageFormat(const PageFormat& pf)
|
|
|
|
{
|
2012-07-06 14:21:05 +02:00
|
|
|
_pageFormat.copy(pf);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// spatium
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
qreal MStyle::spatium() const
|
|
|
|
{
|
|
|
|
return d->spatium();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setSpatium
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::setSpatium(qreal v)
|
|
|
|
{
|
|
|
|
d->setSpatium(v);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// articulationAnchor
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
ArticulationAnchor MStyle::articulationAnchor(int id) const
|
|
|
|
{
|
|
|
|
return d->articulationAnchor(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setArticulationAnchor
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MStyle::setArticulationAnchor(int id, ArticulationAnchor val)
|
|
|
|
{
|
|
|
|
return d->setArticulationAnchor(id, val);
|
|
|
|
}
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
}
|
|
|
|
|