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-09-05 16:37:49 +02:00
|
|
|
#include "clef.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
|
|
|
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[] = {
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::staffUpperBorder, StyleType("staffUpperBorder", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::staffLowerBorder, StyleType("staffLowerBorder", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::staffDistance, StyleType("staffDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::akkoladeDistance, StyleType("akkoladeDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::minSystemDistance, StyleType("minSystemDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::maxSystemDistance, StyleType("maxSystemDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::lyricsDistance, StyleType("lyricsDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::lyricsMinBottomDistance, StyleType("lyricsMinBottomDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::lyricsLineHeight, StyleType("lyricsLineHeight", StyleValueType::DOUBLE) }, // in % of normal height (default: 1.0)
|
|
|
|
{ StyleIdx::figuredBassFontFamily, StyleType("figuredBassFontFamily", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::figuredBassFontSize, StyleType("figuredBassFontSize", StyleValueType::DOUBLE) }, // in pt
|
|
|
|
{ StyleIdx::figuredBassYOffset, StyleType("figuredBassYOffset", StyleValueType::DOUBLE) }, // in sp
|
|
|
|
{ StyleIdx::figuredBassLineHeight, StyleType("figuredBassLineHeight", StyleValueType::DOUBLE) }, // in % of normal height
|
|
|
|
{ StyleIdx::figuredBassAlignment, StyleType("figuredBassAlignment", StyleValueType::INT) }, // 0 = top, 1 = bottom
|
|
|
|
{ StyleIdx::figuredBassStyle, StyleType("figuredBassStyle" , StyleValueType::INT) }, // 0=modern, 1=historic
|
|
|
|
{ StyleIdx::systemFrameDistance, StyleType("systemFrameDistance", StyleValueType::SPATIUM) }, // dist. between staff and vertical box
|
|
|
|
{ StyleIdx::frameSystemDistance, StyleType("frameSystemDistance", StyleValueType::SPATIUM) }, // dist. between vertical box and next system
|
|
|
|
{ StyleIdx::minMeasureWidth, StyleType("minMeasureWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::barWidth, StyleType("barWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::doubleBarWidth, StyleType("doubleBarWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::endBarWidth, StyleType("endBarWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::doubleBarDistance, StyleType("doubleBarDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::endBarDistance, StyleType("endBarDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::repeatBarTips, StyleType("repeatBarTips", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::startBarlineSingle, StyleType("startBarlineSingle", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::startBarlineMultiple, StyleType("startBarlineMultiple", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::bracketWidth, StyleType("bracketWidth", StyleValueType::SPATIUM) }, // system bracket line width
|
|
|
|
{ StyleIdx::bracketDistance, StyleType("bracketDistance", StyleValueType::SPATIUM) }, // system bracket distance
|
|
|
|
{ StyleIdx::akkoladeWidth, StyleType("akkoladeWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::akkoladeBarDistance, StyleType("akkoladeBarDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::clefLeftMargin, StyleType("clefLeftMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::keysigLeftMargin, StyleType("keysigLeftMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::timesigLeftMargin, StyleType("timesigLeftMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::clefKeyRightMargin, StyleType("clefKeyRightMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::clefBarlineDistance, StyleType("clefBarlineDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::stemWidth, StyleType("stemWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::shortenStem, StyleType("shortenStem", StyleValueType::BOOL) }, // StyleIdx::shortenStem,
|
|
|
|
{ StyleIdx::shortStemProgression, StyleType("shortStemProgression", StyleValueType::SPATIUM) }, // StyleIdx::shortStemProgression,
|
|
|
|
{ StyleIdx::shortestStem, StyleType("shortestStem", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::beginRepeatLeftMargin, StyleType("beginRepeatLeftMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::minNoteDistance, StyleType("minNoteDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::barNoteDistance, StyleType("barNoteDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::barAccidentalDistance, StyleType("barAccidentalDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::multiMeasureRestMargin, StyleType("multiMeasureRestMargin", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::noteBarDistance, StyleType("noteBarDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::measureSpacing, StyleType("measureSpacing", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::staffLineWidth, StyleType("staffLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ledgerLineWidth, StyleType("ledgerLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ledgerLineLength, StyleType("ledgerLineLength", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::accidentalDistance, StyleType("accidentalDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::accidentalNoteDistance, StyleType("accidentalNoteDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::beamWidth, StyleType("beamWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::beamDistance, StyleType("beamDistance", StyleValueType::DOUBLE) }, // in beamWidth units
|
|
|
|
{ StyleIdx::beamMinLen, StyleType("beamMinLen", StyleValueType::SPATIUM) }, // len for broken beams
|
|
|
|
{ StyleIdx::beamNoSlope, StyleType("beamNoSlope", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::dotMag, StyleType("dotMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::dotNoteDistance, StyleType("dotNoteDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::dotRestDistance, StyleType("dotRestDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::dotDotDistance, StyleType("dotDotDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::propertyDistanceHead, StyleType("propertyDistanceHead", StyleValueType::SPATIUM) }, // note property to note head
|
|
|
|
{ StyleIdx::propertyDistanceStem, StyleType("propertyDistanceStem", StyleValueType::SPATIUM) }, // note property to note stem
|
|
|
|
{ StyleIdx::propertyDistance, StyleType("propertyDistance", StyleValueType::SPATIUM) }, // note property to note property
|
|
|
|
{ StyleIdx::articulationMag, StyleType("articulationMag", StyleValueType::DOUBLE) }, // note property to note property
|
|
|
|
{ StyleIdx::lastSystemFillLimit, StyleType("lastSystemFillLimit", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::hairpinY, StyleType("hairpinY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::hairpinHeight, StyleType("hairpinHeight", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::hairpinContHeight, StyleType("hairpinContHeight", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::hairpinLineWidth, StyleType("hairpinWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::pedalY, StyleType("pedalY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::pedalLineWidth, StyleType("pedalLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::pedalLineStyle, StyleType("pedalListStyle", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::trillY, StyleType("trillY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::harmonyY, StyleType("harmonyY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::harmonyFretDist, StyleType("harmonyFretDist", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::minHarmonyDistance, StyleType("minHarmonyDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::maxHarmonyBarDistance, StyleType("maxHarmonyBarDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::capoPosition, StyleType("capoPosition", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::fretNumMag, StyleType("fretNumMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::fretNumPos, StyleType("fretNumPos", StyleValueType::INT) }, // 0 = left, 1 = right
|
|
|
|
{ StyleIdx::fretY, StyleType("fretY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::showPageNumber, StyleType("showPageNumber", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::showPageNumberOne, StyleType("showPageNumberOne", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::pageNumberOddEven, StyleType("pageNumberOddEven", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::showMeasureNumber, StyleType("showMeasureNumber", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::showMeasureNumberOne, StyleType("showMeasureNumberOne", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::measureNumberInterval, StyleType("measureNumberInterval", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::measureNumberSystem, StyleType("measureNumberSystem", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::measureNumberAllStaffs, StyleType("measureNumberAllStaffs", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::smallNoteMag, StyleType("smallNoteMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::graceNoteMag, StyleType("graceNoteMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::smallStaffMag, StyleType("smallStaffMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::smallClefMag, StyleType("smallClefMag", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::genClef, StyleType("genClef", StyleValueType::BOOL) }, // create clef for all systems, not only for first
|
|
|
|
{ StyleIdx::genKeysig, StyleType("genKeysig", StyleValueType::BOOL) }, // create key signature for all systems
|
|
|
|
{ StyleIdx::genTimesig, StyleType("genTimesig", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::genCourtesyTimesig, StyleType("genCourtesyTimesig", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::genCourtesyKeysig, StyleType("genCourtesyKeysig", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::genCourtesyClef, StyleType("genCourtesyClef", StyleValueType::BOOL) },
|
2014-06-21 15:16:17 +02:00
|
|
|
{ StyleIdx::swingRatio, StyleType("swingRatio", StyleValueType::INT) },
|
2014-07-24 20:09:49 +02:00
|
|
|
{ StyleIdx::swingUnit, StyleType("swingUnit", StyleValueType::STRING) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::useStandardNoteNames, StyleType("useStandardNoteNames", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::useGermanNoteNames, StyleType("useGermanNoteNames", StyleValueType::BOOL) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::useFullGermanNoteNames, StyleType("useFullGermanNoteNames", StyleValueType::BOOL) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::useSolfeggioNoteNames, StyleType("useSolfeggioNoteNames", StyleValueType::BOOL) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::useFrenchNoteNames, StyleType("useFrenchNoteNames", StyleValueType::BOOL) },
|
2014-12-17 18:15:26 +01:00
|
|
|
{ StyleIdx::automaticCapitalization, StyleType("automaticCapitalization", StyleValueType::BOOL) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::lowerCaseMinorChords, StyleType("lowerCaseMinorChords", StyleValueType::BOOL) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::lowerCaseBassNotes, StyleType("lowerCaseBassNotes", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::allCapsNoteNames, StyleType("allCapsNoteNames", StyleValueType::BOOL) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::chordStyle, StyleType("chordStyle", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::chordsXmlFile, StyleType("chordsXmlFile", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::chordDescriptionFile, StyleType("chordDescriptionFile", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::concertPitch, StyleType("concertPitch", StyleValueType::BOOL) }, // display transposing instruments in concert pitch
|
|
|
|
{ StyleIdx::createMultiMeasureRests, StyleType("createMultiMeasureRests", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::minEmptyMeasures, StyleType("minEmptyMeasures", StyleValueType::INT) }, // minimum number of empty measures for multi measure rest
|
|
|
|
{ StyleIdx::minMMRestWidth, StyleType("minMMRestWidth", StyleValueType::SPATIUM) }, // minimum width of multi measure rest
|
|
|
|
{ StyleIdx::hideEmptyStaves, StyleType("hideEmptyStaves", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::dontHideStavesInFirstSystem, StyleType("dontHidStavesInFirstSystm", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::hideInstrumentNameIfOneInstrument, StyleType("hideInstrumentNameIfOneInstrument", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::gateTime, StyleType("gateTime", StyleValueType::INT) }, // 0-100%
|
|
|
|
{ StyleIdx::tenutoGateTime, StyleType("tenutoGateTime", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::staccatoGateTime, StyleType("staccatoGateTime", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::slurGateTime, StyleType("slurGateTime", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::ArpeggioNoteDistance, StyleType("ArpeggioNoteDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ArpeggioLineWidth, StyleType("ArpeggioLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ArpeggioHookLen, StyleType("ArpeggioHookLen", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::FixMeasureNumbers, StyleType("FixMeasureNumbers", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::FixMeasureWidth, StyleType("FixMeasureWidth", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::SlurEndWidth, StyleType("slurEndWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::SlurMidWidth, StyleType("slurMidWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::SlurDottedWidth, StyleType("slurDottedWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::MinTieLength, StyleType("minTieLength", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::SectionPause, StyleType("sectionPause", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::MusicalSymbolFont, StyleType("musicalSymbolFont", StyleValueType::STRING) },
|
2014-07-26 11:03:22 +02:00
|
|
|
{ StyleIdx::MusicalTextFont, StyleType("musicalTextFont", StyleValueType::STRING) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::showHeader, StyleType("showHeader", StyleValueType::BOOL) },
|
2014-06-06 12:40:22 +02:00
|
|
|
// { StyleIdx::headerStyled, StyleType("headerStyled", StyleValueType::BOOL) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::headerFirstPage, StyleType("headerFirstPage", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::headerOddEven, StyleType("headerOddEven", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::evenHeaderL, StyleType("evenHeaderL", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::evenHeaderC, StyleType("evenHeaderC", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::evenHeaderR, StyleType("evenHeaderR", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddHeaderL, StyleType("oddHeaderL", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddHeaderC, StyleType("oddHeaderC", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddHeaderR, StyleType("oddHeaderR", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::showFooter, StyleType("showFooter", StyleValueType::BOOL) },
|
2014-06-06 12:40:22 +02:00
|
|
|
// { StyleIdx::footerStyled, StyleType("footerStyled", StyleValueType::BOOL) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::footerFirstPage, StyleType("footerFirstPage", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::footerOddEven, StyleType("footerOddEven", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::evenFooterL, StyleType("evenFooterL", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::evenFooterC, StyleType("evenFooterC", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::evenFooterR, StyleType("evenFooterR", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddFooterL, StyleType("oddFooterL", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddFooterC, StyleType("oddFooterC", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::oddFooterR, StyleType("oddFooterR", StyleValueType::STRING) },
|
|
|
|
{ StyleIdx::voltaY, StyleType("voltaY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::voltaHook, StyleType("voltaHook", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::voltaLineWidth, StyleType("voltaLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::voltaLineStyle, StyleType("voltaLineStyle", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::ottavaY, StyleType("ottavaY", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ottavaHook, StyleType("ottavaHook", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ottavaLineWidth, StyleType("ottavaLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::ottavaLineStyle, StyleType("ottavaLineStyle", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::ottavaNumbersOnly, StyleType("ottavaNumbersOnly", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::tabClef, StyleType("tabClef", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::tremoloWidth, StyleType("tremoloWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tremoloBoxHeight, StyleType("tremoloBoxHeight", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tremoloStrokeWidth, StyleType("tremoloLineWidth", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tremoloDistance, StyleType("tremoloDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::linearStretch, StyleType("linearStretch", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::crossMeasureValues, StyleType("crossMeasureValues", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::keySigNaturals, StyleType("keySigNaturals", StyleValueType::INT) },
|
|
|
|
{ StyleIdx::tupletMaxSlope, StyleType("tupletMaxSlope", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::tupletOufOfStaff, StyleType("tupletOufOfStaff", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::tupletVHeadDistance, StyleType("tupletVHeadDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tupletVStemDistance, StyleType("tupletVStemDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tupletStemLeftDistance, StyleType("tupletStemLeftDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tupletStemRightDistance, StyleType("tupletStemRightDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::tupletNoteLeftDistance, StyleType("tupletNoteLeftDistance", StyleValueType::SPATIUM) },
|
2015-01-16 14:51:09 +01:00
|
|
|
{ StyleIdx::tupletNoteRightDistance, StyleType("tupletNoteRightDistance", StyleValueType::SPATIUM) },
|
|
|
|
{ StyleIdx::barreLineWidth, StyleType("barreLineWidth", StyleValueType::DOUBLE) },
|
|
|
|
{ StyleIdx::fretMag, StyleType("fretMag", StyleValueType::DOUBLE) },
|
2015-01-26 10:23:35 +01:00
|
|
|
{ StyleIdx::scaleBarlines, StyleType("scaleBarlines", StyleValueType::BOOL) },
|
|
|
|
{ StyleIdx::barGraceDistance, StyleType("barGraceDistance", StyleValueType::SPATIUM) }
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class StyleTypes {
|
2014-05-26 15:31:36 +02:00
|
|
|
StyleType st[int(StyleIdx::STYLES)];
|
2013-07-23 16:43:56 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
StyleTypes()
|
|
|
|
{
|
|
|
|
for (auto i : styleTypes2)
|
2014-05-26 15:31:36 +02:00
|
|
|
st[int(i.idx)] = i.val;
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
2014-05-26 15:31:36 +02:00
|
|
|
const char* name(StyleIdx i) const { return st[int(i)].name(); }
|
|
|
|
StyleValueType valueType(StyleIdx i) const { return st[int(i)].valueType(); }
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const StyleTypes styleTypes;
|
|
|
|
|
2015-01-22 16:27:16 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// valueType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
StyleValueType MStyle::valueType(const StyleIdx i)
|
|
|
|
{
|
|
|
|
return styleTypes.valueType(i);
|
|
|
|
}
|
|
|
|
|
2014-01-22 16:19:54 +01:00
|
|
|
static const QString ff("FreeSerif");
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setDefaultStyle
|
|
|
|
// synchronize with TextStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void initStyle(MStyle* s)
|
|
|
|
{
|
2014-08-12 14:16:11 +02:00
|
|
|
#define MM(x) ((x)/INCH)
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
// this is an empty style, no offsets are allowed
|
2013-02-25 00:18:14 +01:00
|
|
|
// never show this style
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", ""), ff, 10, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(), OffsetType::SPATIUM, false,
|
|
|
|
false, Spatium(.2), Spatium(.5), 25, QColor(Qt::black), false, false, QColor(Qt::black),
|
|
|
|
QColor(255, 255, 255, 0), TextStyleHidden::ALWAYS));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Title"), ff, 24, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::TOP, QPointF(), OffsetType::ABS));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Subtitle"), ff, 14, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::TOP, QPointF(0, MM(10)), OffsetType::ABS));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Composer"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::BOTTOM, QPointF(), OffsetType::ABS));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Lyricist"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BOTTOM, QPointF(), OffsetType::ABS));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Lyrics Odd Lines"), ff, 11, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BASELINE, QPointF(0, 6), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Lyrics Even Lines"), ff, 11, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BASELINE, QPointF(0, 6), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Fingering"), ff, 8, false, false, false,
|
2014-10-17 03:43:54 +02:00
|
|
|
AlignmentFlags::CENTER, QPointF(), OffsetType::SPATIUM, true));
|
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "LH Guitar Fingering"), ff, 8, false, false, false,
|
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::VCENTER, QPointF(-0.5, 0), OffsetType::SPATIUM, true));
|
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "RH Guitar Fingering"), ff, 8, false, false, false,
|
|
|
|
AlignmentFlags::CENTER, QPointF(), OffsetType::SPATIUM, true));
|
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "String Number"), ff, 8, false, false, false,
|
|
|
|
AlignmentFlags::CENTER, QPointF(0, -2.0), OffsetType::SPATIUM, true,
|
|
|
|
true, Spatium(.1), Spatium(.2), 0, Qt::black, true, false));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Instrument Name (Long)"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::VCENTER, QPointF(), OffsetType::ABS, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Instrument Name (Short)"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::VCENTER, QPointF(), OffsetType::ABS, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Instrument Name (Part)"), ff, 18, false, false, false,
|
2014-10-19 19:06:49 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::TOP, QPointF(), OffsetType::ABS));
|
2014-07-23 12:35:56 +02:00
|
|
|
|
|
|
|
// dynamics size is 12pt for bravura-text
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Dynamics"), ff, 12, false, false,false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BASELINE, QPointF(0.0, 8.0), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Technique"), ff, 12, false, true, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(0.0, -2.0), OffsetType::SPATIUM));
|
|
|
|
|
2014-08-11 21:53:48 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Tempo"), ff, 12, true, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(0, -4.0), OffsetType::SPATIUM,
|
|
|
|
true, false, Spatium(.2), Spatium(.5), 0, Qt::black, false, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Metronome"), ff, 12, true, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Measure Number"), ff, 8, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BOTTOM, QPointF(.0, -2.0), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Translator"), ff, 11, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::TOP, QPointF(0, 6)));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Tuplet"), ff, 10, false, true, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::CENTER, QPointF(), OffsetType::ABS, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "System"), ff, 10, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT, QPointF(0, -4.0), OffsetType::SPATIUM, true,
|
|
|
|
false, Spatium(.2), Spatium(.5), 25, Qt::black, false, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Staff"), ff, 10, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT, QPointF(0, -4.0), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Chord Symbol"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(), OffsetType::SPATIUM, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Rehearsal Mark"), ff, 14, true, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BASELINE, QPointF(0, -3.0), OffsetType::SPATIUM, true,
|
|
|
|
true, Spatium(.2), Spatium(.5), 20, Qt::black, false, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Repeat Text Left"), ff, 20, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(0, -2.0), OffsetType::SPATIUM, true,
|
|
|
|
false, Spatium(.2), Spatium(.5), 25, Qt::black, false, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Repeat Text Right"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::BASELINE, QPointF(0, -2.0), OffsetType::SPATIUM, true,
|
|
|
|
false, Spatium(0.2), Spatium(0.5), 25, Qt::black, false, true));
|
|
|
|
|
|
|
|
// for backward compatibility
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Repeat Text"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::BASELINE, QPointF(0, -2.0), OffsetType::SPATIUM, true,
|
|
|
|
false, Spatium(0.2), Spatium(0.5), 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
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Volta"), ff, 11, true, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BASELINE, QPointF(0.5, 1.9), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Frame"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::TOP));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Text Line"), ff, 12, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::VCENTER, QPointF(), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Glissando"), ff, 8, false, true, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BASELINE, QPointF(), OffsetType::SPATIUM, true));
|
|
|
|
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Ottava"), ff, 12, false, true, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::VCENTER, QPointF(), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Bend"), ff, 8, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::CENTER | AlignmentFlags::BOTTOM, QPointF(), OffsetType::SPATIUM, true));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Header"), ff, 8, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::TOP));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Footer"), ff, 8, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::HCENTER | AlignmentFlags::BOTTOM, QPointF(0.0, MM(5)), OffsetType::ABS));
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Instrument Change"), ff, 12, true, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::BOTTOM, QPointF(0, -3.0), OffsetType::SPATIUM, true));
|
|
|
|
|
2014-10-22 17:33:59 +02:00
|
|
|
/* s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Lyrics Verse Number"),ff, 11, false, false, false,
|
|
|
|
AlignmentFlags::RIGHT | AlignmentFlags::BASELINE, QPointF(), OffsetType::SPATIUM, true));
|
|
|
|
*/
|
2014-08-12 14:25:45 +02:00
|
|
|
s->addTextStyle(TextStyle(QT_TRANSLATE_NOOP ("TextStyle", "Figured Bass"), "MScoreBC", 8, false, false, false,
|
2014-08-12 14:16:11 +02:00
|
|
|
AlignmentFlags::LEFT | AlignmentFlags::TOP, QPointF(0, 6), OffsetType::SPATIUM, true,
|
2014-04-25 11:50:31 +02:00
|
|
|
false, Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, // default params
|
|
|
|
false, QColor(Qt::black), QColor(255, 255, 255, 0), // default params
|
2014-08-12 14:16:11 +02:00
|
|
|
TextStyleHidden::IN_EDITOR)); // don't show in Style Editor
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
#undef MM
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// Style
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
StyleData::StyleData()
|
2014-05-26 15:31:36 +02:00
|
|
|
: _values(int(StyleIdx::STYLES))
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
_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[] = {
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::staffUpperBorder, 7.0 },
|
|
|
|
{ StyleIdx::staffLowerBorder, 7.0 },
|
|
|
|
{ StyleIdx::staffDistance, 6.5 },
|
|
|
|
{ StyleIdx::akkoladeDistance, 6.5 },
|
|
|
|
{ StyleIdx::minSystemDistance, 8.5 },
|
|
|
|
{ StyleIdx::maxSystemDistance, 15.0 },
|
2014-08-04 20:28:03 +02:00
|
|
|
{ StyleIdx::lyricsDistance, 2.0 },
|
|
|
|
{ StyleIdx::lyricsMinBottomDistance, 4.0 },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::lyricsLineHeight, QVariant(1.0) },
|
2014-08-14 11:40:27 +02:00
|
|
|
{ StyleIdx::figuredBassFontFamily, QVariant(QString("MScoreBC")) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::figuredBassFontSize, QVariant(8.0) },
|
|
|
|
{ StyleIdx::figuredBassYOffset, QVariant(6.0) },
|
|
|
|
{ StyleIdx::figuredBassLineHeight, QVariant(1.0) },
|
|
|
|
{ StyleIdx::figuredBassAlignment, QVariant(0) },
|
|
|
|
{ StyleIdx::figuredBassStyle, QVariant(0) },
|
|
|
|
{ StyleIdx::systemFrameDistance, QVariant(7.0) },
|
|
|
|
{ StyleIdx::frameSystemDistance, QVariant(7.0) },
|
|
|
|
{ StyleIdx::minMeasureWidth, QVariant(5.0) },
|
|
|
|
{ StyleIdx::barWidth, QVariant(0.16) }, // 0.1875
|
|
|
|
{ StyleIdx::doubleBarWidth, QVariant(0.16) },
|
|
|
|
{ StyleIdx::endBarWidth, QVariant(0.5) }, // 0.5
|
|
|
|
{ StyleIdx::doubleBarDistance, QVariant(0.30) },
|
|
|
|
{ StyleIdx::endBarDistance, QVariant(0.40) }, // 0.3
|
|
|
|
{ StyleIdx::repeatBarTips, QVariant(false) },
|
|
|
|
{ StyleIdx::startBarlineSingle, QVariant(false) },
|
|
|
|
{ StyleIdx::startBarlineMultiple, QVariant(true) },
|
|
|
|
{ StyleIdx::bracketWidth, QVariant(0.45) },
|
2014-08-14 11:40:27 +02:00
|
|
|
{ StyleIdx::bracketDistance, QVariant(0.1) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::akkoladeWidth, QVariant(1.6) },
|
|
|
|
{ StyleIdx::akkoladeBarDistance, QVariant(.4) },
|
|
|
|
{ StyleIdx::clefLeftMargin, QVariant(0.64) },
|
|
|
|
{ StyleIdx::keysigLeftMargin, QVariant(0.5) },
|
|
|
|
{ StyleIdx::timesigLeftMargin, QVariant(0.5) },
|
|
|
|
{ StyleIdx::clefKeyRightMargin, QVariant(1.75) },
|
|
|
|
{ StyleIdx::clefBarlineDistance, QVariant(0.18) }, // was 0.5
|
|
|
|
{ StyleIdx::stemWidth, QVariant(0.13) }, // 0.09375
|
|
|
|
{ StyleIdx::shortenStem, QVariant(true) },
|
|
|
|
{ StyleIdx::shortStemProgression, QVariant(0.25) },
|
|
|
|
{ StyleIdx::shortestStem, QVariant(2.25) },
|
|
|
|
{ StyleIdx::beginRepeatLeftMargin, QVariant(1.0) },
|
|
|
|
{ StyleIdx::minNoteDistance, QVariant(0.25) }, // 0.4
|
|
|
|
{ StyleIdx::barNoteDistance, QVariant(1.2) },
|
|
|
|
{ StyleIdx::barAccidentalDistance, QVariant(.3) },
|
|
|
|
{ StyleIdx::multiMeasureRestMargin, QVariant(1.2) },
|
|
|
|
{ StyleIdx::noteBarDistance, QVariant(1.0) },
|
|
|
|
{ StyleIdx::measureSpacing, QVariant(1.2) },
|
|
|
|
{ StyleIdx::staffLineWidth, QVariant(0.08) }, // 0.09375
|
|
|
|
{ StyleIdx::ledgerLineWidth, QVariant(0.16) }, // 0.1875
|
|
|
|
{ StyleIdx::ledgerLineLength, QVariant(.6) }, // note head width + this value
|
|
|
|
{ StyleIdx::accidentalDistance, QVariant(0.22) },
|
|
|
|
{ StyleIdx::accidentalNoteDistance, QVariant(0.22) },
|
|
|
|
{ StyleIdx::beamWidth, QVariant(0.5) }, // was 0.48
|
|
|
|
{ StyleIdx::beamDistance, QVariant(0.5) }, // 0.25sp
|
2014-08-14 11:40:27 +02:00
|
|
|
{ StyleIdx::beamMinLen, QVariant(1.32) }, // 1.316178 exactly note head width
|
|
|
|
{ StyleIdx::beamNoSlope, QVariant(false) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::dotMag, QVariant(1.0) },
|
|
|
|
{ StyleIdx::dotNoteDistance, QVariant(0.35) },
|
|
|
|
{ StyleIdx::dotRestDistance, QVariant(0.25) },
|
|
|
|
{ StyleIdx::dotDotDistance, QVariant(0.5) },
|
|
|
|
{ StyleIdx::propertyDistanceHead, QVariant(1.0) },
|
|
|
|
{ StyleIdx::propertyDistanceStem, QVariant(1.8) },
|
|
|
|
{ StyleIdx::propertyDistance, QVariant(1.0) },
|
|
|
|
{ StyleIdx::articulationMag, QVariant(1.0) },
|
|
|
|
{ StyleIdx::lastSystemFillLimit, QVariant(0.3) },
|
2014-07-26 19:54:55 +02:00
|
|
|
{ StyleIdx::hairpinY, QVariant(7.5) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::hairpinHeight, QVariant(1.2) },
|
|
|
|
{ StyleIdx::hairpinContHeight, QVariant(0.5) },
|
|
|
|
{ StyleIdx::hairpinLineWidth, QVariant(0.13) },
|
|
|
|
{ StyleIdx::pedalY, QVariant(8) },
|
|
|
|
{ StyleIdx::pedalLineWidth, QVariant(.15) },
|
|
|
|
{ StyleIdx::pedalLineStyle, QVariant(int(Qt::SolidLine)) },
|
|
|
|
{ StyleIdx::trillY, QVariant(-1) },
|
|
|
|
{ StyleIdx::harmonyY, QVariant(2.5) },
|
|
|
|
{ StyleIdx::harmonyFretDist, QVariant(0.5) },
|
|
|
|
{ StyleIdx::minHarmonyDistance, QVariant(0.5) },
|
|
|
|
{ StyleIdx::maxHarmonyBarDistance, QVariant(3.0) },
|
|
|
|
{ StyleIdx::capoPosition, QVariant(0) },
|
2014-08-14 11:40:27 +02:00
|
|
|
{ StyleIdx::fretNumMag, QVariant(2.0) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::fretNumPos, QVariant(0) },
|
|
|
|
{ StyleIdx::fretY, QVariant(2.0) },
|
|
|
|
{ StyleIdx::showPageNumber, QVariant(true) },
|
|
|
|
{ StyleIdx::showPageNumberOne, QVariant(false) },
|
|
|
|
{ StyleIdx::pageNumberOddEven, QVariant(true) },
|
|
|
|
{ StyleIdx::showMeasureNumber, QVariant(true) },
|
|
|
|
{ StyleIdx::showMeasureNumberOne, QVariant(false) },
|
|
|
|
{ StyleIdx::measureNumberInterval, QVariant(5) },
|
|
|
|
{ StyleIdx::measureNumberSystem, QVariant(true) },
|
|
|
|
{ StyleIdx::measureNumberAllStaffs, QVariant(false) },
|
2014-08-14 11:40:27 +02:00
|
|
|
{ StyleIdx::smallNoteMag, QVariant(.7) },
|
|
|
|
{ StyleIdx::graceNoteMag, QVariant(0.7) },
|
|
|
|
{ StyleIdx::smallStaffMag, QVariant(0.7) },
|
|
|
|
{ StyleIdx::smallClefMag, QVariant(0.8) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::genClef, QVariant(true) },
|
|
|
|
{ StyleIdx::genKeysig, QVariant(true) },
|
|
|
|
{ StyleIdx::genTimesig, QVariant(true) },
|
|
|
|
{ StyleIdx::genCourtesyTimesig, QVariant(true) },
|
|
|
|
{ StyleIdx::genCourtesyKeysig, QVariant(true) },
|
|
|
|
{ StyleIdx::genCourtesyClef, QVariant(true) },
|
2014-06-21 15:16:17 +02:00
|
|
|
{ StyleIdx::swingRatio, QVariant(60) },
|
2014-07-24 20:09:49 +02:00
|
|
|
{ StyleIdx::swingUnit, QVariant(QString("")) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::useStandardNoteNames, QVariant(true) },
|
|
|
|
{ StyleIdx::useGermanNoteNames, QVariant(false) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::useFullGermanNoteNames, QVariant(false) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::useSolfeggioNoteNames, QVariant(false) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::useFrenchNoteNames, QVariant(false) },
|
2014-12-17 18:15:26 +01:00
|
|
|
{ StyleIdx::automaticCapitalization, QVariant(true) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::lowerCaseMinorChords, QVariant(false) },
|
2014-12-10 08:12:00 +01:00
|
|
|
{ StyleIdx::lowerCaseBassNotes, QVariant(false) },
|
|
|
|
{ StyleIdx::allCapsNoteNames, QVariant(false) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::chordStyle, QVariant(QString("std")) },
|
|
|
|
{ StyleIdx::chordsXmlFile, QVariant(false) },
|
|
|
|
{ StyleIdx::chordDescriptionFile, QVariant(QString("chords_std.xml")) },
|
|
|
|
{ StyleIdx::concertPitch, QVariant(false) },
|
|
|
|
{ StyleIdx::createMultiMeasureRests, QVariant(false) },
|
|
|
|
{ StyleIdx::minEmptyMeasures, QVariant(2) },
|
|
|
|
{ StyleIdx::minMMRestWidth, QVariant(4) },
|
|
|
|
{ StyleIdx::hideEmptyStaves, QVariant(false) },
|
|
|
|
{ StyleIdx::dontHideStavesInFirstSystem, QVariant(true) },
|
|
|
|
{ StyleIdx::hideInstrumentNameIfOneInstrument, QVariant(true) },
|
|
|
|
{ StyleIdx::gateTime, QVariant(100) },
|
|
|
|
{ StyleIdx::tenutoGateTime, QVariant(100) },
|
|
|
|
{ StyleIdx::staccatoGateTime, QVariant(50) },
|
|
|
|
{ StyleIdx::slurGateTime, QVariant(100) },
|
|
|
|
{ StyleIdx::ArpeggioNoteDistance, QVariant(.5) },
|
|
|
|
{ StyleIdx::ArpeggioLineWidth, QVariant(.18) },
|
|
|
|
{ StyleIdx::ArpeggioHookLen, QVariant(.8) },
|
|
|
|
{ StyleIdx::FixMeasureNumbers, QVariant(0) },
|
|
|
|
{ StyleIdx::FixMeasureWidth, QVariant(false) },
|
|
|
|
{ StyleIdx::SlurEndWidth, QVariant(.07) },
|
|
|
|
{ StyleIdx::SlurMidWidth, QVariant(.15) },
|
|
|
|
{ StyleIdx::SlurDottedWidth, QVariant(.1) },
|
|
|
|
{ StyleIdx::MinTieLength, QVariant(1.0) },
|
|
|
|
{ StyleIdx::SectionPause, QVariant(qreal(3.0)) },
|
|
|
|
{ StyleIdx::MusicalSymbolFont, QVariant(QString("Emmentaler")) },
|
2014-07-26 13:39:00 +02:00
|
|
|
{ StyleIdx::MusicalTextFont, QVariant(QString("MScore Text")) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::showHeader, QVariant(false) },
|
2014-06-06 12:40:22 +02:00
|
|
|
// { StyleIdx::headerStyled, QVariant(true) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::headerFirstPage, QVariant(false) },
|
|
|
|
{ StyleIdx::headerOddEven, QVariant(true) },
|
|
|
|
{ StyleIdx::evenHeaderL, QVariant(QString()) },
|
|
|
|
{ StyleIdx::evenHeaderC, QVariant(QString()) },
|
|
|
|
{ StyleIdx::evenHeaderR, QVariant(QString()) },
|
|
|
|
{ StyleIdx::oddHeaderL, QVariant(QString()) },
|
|
|
|
{ StyleIdx::oddHeaderC, QVariant(QString()) },
|
|
|
|
{ StyleIdx::oddHeaderR, QVariant(QString()) },
|
|
|
|
{ StyleIdx::showFooter, QVariant(true) },
|
2014-06-06 12:40:22 +02:00
|
|
|
// { StyleIdx::footerStyled, QVariant(true) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::footerFirstPage, QVariant(true) },
|
|
|
|
{ StyleIdx::footerOddEven, QVariant(true) },
|
|
|
|
{ StyleIdx::evenFooterL, QVariant(QString("$p")) },
|
|
|
|
{ StyleIdx::evenFooterC, QVariant(QString("$:copyright:")) },
|
|
|
|
{ StyleIdx::evenFooterR, QVariant(QString()) },
|
|
|
|
{ StyleIdx::oddFooterL, QVariant(QString()) },
|
|
|
|
{ StyleIdx::oddFooterC, QVariant(QString("$:copyright:")) },
|
|
|
|
{ StyleIdx::oddFooterR, QVariant(QString("$p")) },
|
|
|
|
{ StyleIdx::voltaY, QVariant(-3.0) },
|
|
|
|
{ StyleIdx::voltaHook, QVariant(1.9) },
|
|
|
|
{ StyleIdx::voltaLineWidth, QVariant(.1) },
|
|
|
|
{ StyleIdx::voltaLineStyle, QVariant(int(Qt::SolidLine)) },
|
|
|
|
{ StyleIdx::ottavaY, QVariant(-3.0) },
|
|
|
|
{ StyleIdx::ottavaHook, QVariant(1.9) },
|
|
|
|
{ StyleIdx::ottavaLineWidth, QVariant(.1) },
|
|
|
|
{ StyleIdx::ottavaLineStyle, QVariant(int(Qt::DashLine)) },
|
|
|
|
{ StyleIdx::ottavaNumbersOnly, true },
|
2014-05-29 18:45:32 +02:00
|
|
|
{ StyleIdx::tabClef, QVariant(int(ClefType::TAB)) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::tremoloWidth, QVariant(1.2) }, // tremolo stroke width: note head width
|
|
|
|
{ StyleIdx::tremoloBoxHeight, QVariant(0.65) },
|
|
|
|
{ StyleIdx::tremoloStrokeWidth, QVariant(0.35) },
|
|
|
|
{ StyleIdx::tremoloDistance, QVariant(0.8) },
|
|
|
|
{ StyleIdx::linearStretch, QVariant(qreal(1.5)) },
|
|
|
|
{ StyleIdx::crossMeasureValues, QVariant(false) },
|
2014-05-27 12:17:24 +02:00
|
|
|
{ StyleIdx::keySigNaturals, QVariant(int(KeySigNatural::NONE)) },
|
2014-05-26 15:31:36 +02:00
|
|
|
{ StyleIdx::tupletMaxSlope, QVariant(qreal(0.5)) },
|
|
|
|
{ StyleIdx::tupletOufOfStaff, QVariant(true) },
|
|
|
|
{ StyleIdx::tupletVHeadDistance, QVariant(.5) },
|
|
|
|
{ StyleIdx::tupletVStemDistance, QVariant(.25) },
|
|
|
|
{ StyleIdx::tupletStemLeftDistance, QVariant(.5) },
|
|
|
|
{ StyleIdx::tupletStemRightDistance, QVariant(.5) },
|
|
|
|
{ StyleIdx::tupletNoteLeftDistance, QVariant(0.0) },
|
2015-01-16 14:51:09 +01:00
|
|
|
{ StyleIdx::tupletNoteRightDistance, QVariant(0.0) },
|
|
|
|
{ StyleIdx::barreLineWidth, QVariant(1.0) },
|
2015-01-22 15:31:32 +01:00
|
|
|
{ StyleIdx::fretMag, QVariant(1.0) },
|
2015-01-26 10:23:35 +01:00
|
|
|
{ StyleIdx::scaleBarlines, QVariant(true) },
|
|
|
|
{ StyleIdx::barGraceDistance, QVariant(.6) },
|
2013-07-23 16:43:56 +02:00
|
|
|
};
|
|
|
|
for (unsigned i = 0; i < sizeof(values2)/sizeof(*values2); ++i)
|
2014-05-26 15:31:36 +02:00
|
|
|
_values[int(values2[i].idx)] = values2[i].val;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
// _textStyles.append(TextStyle(defaultTextStyles[i]));
|
|
|
|
_spatium = SPATIUM20 * MScore::DPI;
|
2014-06-06 12:40:22 +02:00
|
|
|
|
2014-05-26 21:55:26 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::Fermata)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Shortfermata)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Longfermata)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Verylongfermata)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Sforzatoaccent)] = ArticulationAnchor::CHORD;
|
|
|
|
// _articulationAnchor[int(ArticulationType::Espressivo)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::Staccato)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::Staccatissimo)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::Tenuto)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::Portato)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::Marcato)] = ArticulationAnchor::CHORD;
|
2014-06-18 10:49:01 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::FadeIn)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::FadeOut)] = ArticulationAnchor::CHORD;
|
2014-08-06 10:49:16 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::VolumeSwell)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::WiggleSawtooth)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::WiggleSawtoothWide)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::WiggleVibratoLargeFaster)] = ArticulationAnchor::CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::WiggleVibratoLargeSlowest)] = ArticulationAnchor::CHORD;
|
2014-06-03 20:45:05 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::Ouvert)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Plusstop)] = ArticulationAnchor::TOP_STAFF;
|
2014-05-26 21:55:26 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::Upbow)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Downbow)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Reverseturn)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Turn)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Trill)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Prall)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Mordent)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::PrallPrall)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::PrallMordent)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::UpPrall)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::DownPrall)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::UpMordent)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::DownMordent)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::PrallDown)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::PrallUp)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::LinePrall)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Schleifer)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::Snappizzicato)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
// _articulationAnchor[int(ArticulationType::Tapping)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
// _articulationAnchor[int(ArticulationType::Slapping)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
// _articulationAnchor[int(ArticulationType::Popping)] = ArticulationAnchor::TOP_STAFF;
|
2014-09-08 19:03:20 +02:00
|
|
|
_articulationAnchor[int(ArticulationType::ThumbPosition)] = ArticulationAnchor::TOP_STAFF;
|
|
|
|
_articulationAnchor[int(ArticulationType::LuteFingThumb)] = ArticulationAnchor::BOTTOM_CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::LuteFingFirst)] = ArticulationAnchor::BOTTOM_CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::LuteFingSecond)] = ArticulationAnchor::BOTTOM_CHORD;
|
|
|
|
_articulationAnchor[int(ArticulationType::LuteFingThird)] = ArticulationAnchor::BOTTOM_CHORD;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2014-05-26 21:55:26 +02:00
|
|
|
for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i)
|
2012-05-26 14:26:10 +02:00
|
|
|
_articulationAnchor[i] = s._articulationAnchor[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// Style
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
StyleData::~StyleData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
TextStyle::TextStyle()
|
|
|
|
{
|
|
|
|
d = new TextStyleData;
|
2014-06-18 12:05:41 +02:00
|
|
|
_hidden = TextStyleHidden::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,
|
2014-02-27 15:24:57 +01:00
|
|
|
const QPointF& _off, OffsetType _ot,
|
2012-05-26 14:26:10 +02:00
|
|
|
bool sd,
|
2014-04-25 11:50:31 +02:00
|
|
|
bool hasFrame, Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
2014-06-18 12:05:41 +02:00
|
|
|
QColor fg, QColor bg, TextStyleHidden hidden)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
d = new TextStyleData(_name, _family, _size,
|
2014-02-27 15:24:57 +01:00
|
|
|
_bold, _italic, _underline, _align, _off, _ot,
|
2014-04-25 11:50:31 +02:00
|
|
|
sd, hasFrame, 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,
|
2014-02-27 15:24:57 +01:00
|
|
|
const QPointF& _off, OffsetType _ot,
|
2012-05-26 14:26:10 +02:00
|
|
|
bool sd,
|
2014-04-25 11:50:31 +02:00
|
|
|
bool _hasFrame, 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
|
|
|
:
|
2014-02-27 15:24:57 +01:00
|
|
|
ElementLayout(_align, _off, _ot),
|
2012-05-26 14:26:10 +02:00
|
|
|
name(_name), size(_size), bold(_bold),
|
|
|
|
italic(_italic), underline(_underline),
|
2014-04-25 11:50:31 +02:00
|
|
|
sizeIsSpatiumDependent(sd), hasFrame(_hasFrame), frameWidth(fw), paddingWidth(pw),
|
2012-05-26 14:26:10 +02:00
|
|
|
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
|
|
|
{
|
2014-04-25 11:50:31 +02:00
|
|
|
//hasFrame = (fw.val() != 0.0) || (bg.alpha() != 0);
|
2012-09-11 21:10:44 +02:00
|
|
|
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.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);
|
|
|
|
}
|
|
|
|
|
2014-03-14 11:30:19 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// writeProperties
|
|
|
|
// write only changes to the reference r
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void TextStyleData::writeProperties(Xml& xml, const TextStyleData& r) const
|
|
|
|
{
|
|
|
|
ElementLayout::writeProperties(xml, r);
|
|
|
|
if (!name.isEmpty() && name != r.name)
|
|
|
|
xml.tag("name", name);
|
|
|
|
if (family != r.family)
|
|
|
|
xml.tag("family", family);
|
|
|
|
if (size != r.size)
|
|
|
|
xml.tag("size", size);
|
|
|
|
if (bold != r.bold)
|
|
|
|
xml.tag("bold", bold);
|
|
|
|
if (italic != r.italic)
|
|
|
|
xml.tag("italic", italic);
|
|
|
|
if (underline != r.underline)
|
|
|
|
xml.tag("underline", underline);
|
|
|
|
if (sizeIsSpatiumDependent != r.sizeIsSpatiumDependent)
|
|
|
|
xml.tag("sizeIsSpatiumDependent", sizeIsSpatiumDependent);
|
|
|
|
if (foregroundColor != r.foregroundColor)
|
|
|
|
xml.tag("foregroundColor", foregroundColor);
|
|
|
|
if (backgroundColor != r.backgroundColor)
|
|
|
|
xml.tag("backgroundColor", backgroundColor);
|
|
|
|
if (hasFrame != r.hasFrame)
|
|
|
|
xml.tag("frame", hasFrame);
|
|
|
|
if (hasFrame) {
|
|
|
|
if (frameWidth.val() != r.frameWidth.val())
|
|
|
|
xml.tag("frameWidthS", frameWidth.val());
|
|
|
|
if (paddingWidth.val() != r.paddingWidth.val())
|
|
|
|
xml.tag("paddingWidthS", paddingWidth.val());
|
|
|
|
if (frameRound != r.frameRound)
|
|
|
|
xml.tag("frameRound", frameRound);
|
|
|
|
if (frameColor != r.frameColor)
|
|
|
|
xml.tag("frameColor", frameColor);
|
|
|
|
if (circle != r.circle)
|
|
|
|
xml.tag("circle", circle);
|
|
|
|
}
|
|
|
|
if (systemFlag != r.systemFlag)
|
|
|
|
xml.tag("systemFlag", systemFlag);
|
|
|
|
}
|
|
|
|
|
2014-03-14 16:16:43 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// restyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void TextStyleData::restyle(const TextStyleData& os, const TextStyleData& ns)
|
|
|
|
{
|
|
|
|
ElementLayout::restyle(os, ns);
|
|
|
|
if (name == os.name)
|
|
|
|
name = ns.name;
|
|
|
|
if (family == os.family)
|
|
|
|
family = ns.family;
|
|
|
|
if (size == os.size)
|
|
|
|
size = ns.size;
|
|
|
|
if (bold == os.bold)
|
|
|
|
bold = ns.bold;
|
|
|
|
if (italic == os.italic)
|
|
|
|
italic = ns.italic;
|
|
|
|
if (underline == os.underline)
|
|
|
|
underline = ns.underline;
|
|
|
|
if (sizeIsSpatiumDependent == os.sizeIsSpatiumDependent)
|
|
|
|
sizeIsSpatiumDependent = ns.sizeIsSpatiumDependent;
|
|
|
|
if (foregroundColor == os.foregroundColor)
|
|
|
|
foregroundColor = ns.foregroundColor;
|
|
|
|
if (backgroundColor == os.backgroundColor)
|
|
|
|
backgroundColor = ns.backgroundColor;
|
|
|
|
if (hasFrame == os.hasFrame)
|
|
|
|
hasFrame = ns.hasFrame;
|
|
|
|
if (frameWidth.val() == os.frameWidth.val())
|
|
|
|
frameWidth = ns.frameWidth;
|
|
|
|
if (paddingWidth.val() == os.paddingWidth.val())
|
|
|
|
paddingWidth = ns.paddingWidth;
|
|
|
|
if (frameRound == os.frameRound)
|
|
|
|
frameRound = ns.frameRound;
|
|
|
|
if (frameColor == os.frameColor)
|
|
|
|
frameColor = ns.frameColor;
|
|
|
|
if (circle == os.circle)
|
|
|
|
circle = ns.circle;
|
|
|
|
if (systemFlag == os.systemFlag)
|
|
|
|
systemFlag = ns.systemFlag;
|
|
|
|
}
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// 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();
|
2014-04-25 11:50:31 +02:00
|
|
|
else if (tag == "frameWidth") { // obsolete
|
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
|
|
|
}
|
2014-03-14 11:30:19 +01:00
|
|
|
else if (tag == "frame")
|
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
|
|
|
{
|
2014-05-26 15:31:36 +02:00
|
|
|
QString oldChordDescriptionFile = value(StyleIdx::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")
|
2014-05-26 15:31:36 +02:00
|
|
|
set(StyleIdx::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
|
2014-05-26 15:31:36 +02:00
|
|
|
set(StyleIdx::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
|
|
|
|
2014-06-19 14:13:05 +02:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < int(StyleIdx::STYLES); ++i) {
|
|
|
|
StyleIdx idx = static_cast<StyleIdx>(i);
|
2013-07-23 16:43:56 +02:00
|
|
|
if (styleTypes.name(idx) == tag) {
|
|
|
|
switch(styleTypes.valueType(idx)) {
|
2014-05-26 14:13:24 +02:00
|
|
|
case StyleValueType::SPATIUM: set(idx, QVariant(val.toDouble())); break;
|
|
|
|
case StyleValueType::DOUBLE: set(idx, QVariant(val.toDouble())); break;
|
|
|
|
case StyleValueType::BOOL: set(idx, QVariant(bool(val.toInt()))); break;
|
|
|
|
case StyleValueType::INT: set(idx, QVariant(val.toInt())); break;
|
|
|
|
case StyleValueType::DIRECTION: set(idx, QVariant(val.toInt())); break;
|
|
|
|
case StyleValueType::STRING: set(idx, QVariant(val)); break;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-06-19 14:13:05 +02:00
|
|
|
if (i >= int(StyleIdx::STYLES)) {
|
|
|
|
if (tag == "oddHeader" || tag == "evenHeader"
|
|
|
|
|| tag == "oddFooter" || tag == "evenFooter"
|
|
|
|
|| tag == "headerStyled" || tag == "footerStyled"
|
2014-06-23 20:35:38 +02:00
|
|
|
|| tag == "beamMinSlope" || tag == "beamMaxSlope"
|
|
|
|
|| tag == "stemDir1" || tag == "stemDir2" || tag == "stemDir3" || tag == "stemDir4"
|
2014-06-19 14:13:05 +02:00
|
|
|
) {
|
|
|
|
; // obsolete
|
|
|
|
}
|
2012-05-26 14:26:10 +02:00
|
|
|
else {
|
|
|
|
int idx2;
|
2014-05-26 21:55:26 +02:00
|
|
|
for (idx2 = 0; idx2 < int(ArticulationType::ARTICULATIONS); ++idx2) {
|
2012-05-26 14:26:10 +02:00
|
|
|
ArticulationInfo& ai = Articulation::articulationList[idx2];
|
2014-06-23 20:35:38 +02:00
|
|
|
// deal with obsolete tags from 1.14 format
|
|
|
|
if (tag == "SforzatoaccentAnchor")
|
|
|
|
tag = "SforzatoAnchor";
|
|
|
|
if (tag == "SnappizzicatorAnchor")
|
|
|
|
tag = "SnappizzicatoAnchor";
|
|
|
|
else if (tag == "EspressivoAnchor")
|
|
|
|
break;
|
|
|
|
if (QString::compare(tag, ai.name + "Anchor", Qt::CaseInsensitive) == 0
|
|
|
|
|| QString::compare(tag, "U" + ai.name + "Anchor", Qt::CaseInsensitive) == 0
|
|
|
|
|| QString::compare(tag, "D" + ai.name + "Anchor", Qt::CaseInsensitive) == 0
|
2013-01-23 14:14:09 +01:00
|
|
|
) {
|
2012-05-26 14:26:10 +02:00
|
|
|
_articulationAnchor[idx2] = ArticulationAnchor(val.toInt());
|
|
|
|
break;
|
|
|
|
}
|
2014-06-24 12:45:21 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
2014-06-19 14:13:05 +02:00
|
|
|
if (idx2 >= int(ArticulationType::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
|
2014-05-26 15:31:36 +02:00
|
|
|
QString newChordDescriptionFile = value(StyleIdx::chordDescriptionFile).toString();
|
2013-06-11 20:26:16 +02:00
|
|
|
if (newChordDescriptionFile != oldChordDescriptionFile && !chordListTag) {
|
2014-05-26 15:31:36 +02:00
|
|
|
if (!newChordDescriptionFile.startsWith("chords_") && value(StyleIdx::chordStyle).toString() == "std") {
|
2013-06-29 01:13:33 +02:00
|
|
|
// should not normally happen,
|
|
|
|
// but treat as "old" (114) score just in case
|
2014-05-26 15:31:36 +02:00
|
|
|
set(StyleIdx::chordStyle, QVariant(QString("custom")));
|
|
|
|
set(StyleIdx::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
|
|
|
}
|
2014-05-26 15:31:36 +02:00
|
|
|
if (value(StyleIdx::chordStyle).toString() == "custom")
|
2013-06-11 20:26:16 +02:00
|
|
|
_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) {
|
2014-05-26 15:31:36 +02:00
|
|
|
if (value(StyleIdx::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
|
|
|
|
{
|
2014-05-26 15:31:36 +02:00
|
|
|
return _values[int(idx)] == MScore::baseStyle()->value(idx);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// save
|
2013-12-26 01:33:19 +01:00
|
|
|
// if optimize is true, save only data which are different
|
|
|
|
// from built-in style ( MScore::baseStyle() )
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void StyleData::save(Xml& xml, bool optimize) const
|
|
|
|
{
|
|
|
|
xml.stag("Style");
|
|
|
|
|
2014-05-26 15:31:36 +02:00
|
|
|
for (int i = 0; i < int(StyleIdx::STYLES); ++i) {
|
2012-05-26 14:26:10 +02:00
|
|
|
StyleIdx idx = StyleIdx(i);
|
|
|
|
if (optimize && isDefault(idx))
|
|
|
|
continue;
|
2013-07-23 16:43:56 +02:00
|
|
|
switch(styleTypes.valueType(idx)) {
|
2014-05-26 14:13:24 +02:00
|
|
|
case StyleValueType::SPATIUM:
|
|
|
|
case StyleValueType::DOUBLE: xml.tag(styleTypes.name(idx), value(idx).toDouble()); break;
|
|
|
|
case StyleValueType::BOOL: xml.tag(styleTypes.name(idx), value(idx).toBool()); break;
|
|
|
|
case StyleValueType::INT: xml.tag(styleTypes.name(idx), value(idx).toInt()); break;
|
|
|
|
case StyleValueType::DIRECTION: xml.tag(styleTypes.name(idx), value(idx).toInt()); break;
|
|
|
|
case StyleValueType::STRING: xml.tag(styleTypes.name(idx), value(idx).toString()); break;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
2014-05-30 10:13:29 +02:00
|
|
|
for (int i = 0; i < int(TextStyleType::TEXT_STYLES); ++i) {
|
2014-07-03 11:22:42 +02:00
|
|
|
if (!optimize || _textStyles[i] != MScore::baseStyle()->textStyle(TextStyleType(i)))
|
2012-05-26 14:26:10 +02:00
|
|
|
_textStyles[i].write(xml);
|
|
|
|
}
|
2014-05-30 10:13:29 +02:00
|
|
|
for (int i = int(TextStyleType::TEXT_STYLES); i < _textStyles.size(); ++i)
|
2012-05-26 14:26:10 +02:00
|
|
|
_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();
|
|
|
|
}
|
2014-05-26 21:55:26 +02:00
|
|
|
for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i) {
|
2013-12-26 01:33:19 +01:00
|
|
|
if (optimize && _articulationAnchor[i] == MScore::baseStyle()->articulationAnchor(i))
|
2012-05-26 14:26:10 +02:00
|
|
|
continue;
|
|
|
|
const ArticulationInfo& ai = Articulation::articulationList[i];
|
|
|
|
xml.tag(ai.name + "Anchor", int(_articulationAnchor[i]));
|
|
|
|
}
|
2014-12-17 16:38:49 +01:00
|
|
|
if (!MScore::saveTemplateMode || (_pageFormat.name() != "A4" && _pageFormat.name() != "Letter"))
|
|
|
|
_pageFormat.write(xml);
|
2012-05-26 14:26:10 +02:00
|
|
|
xml.tag("Spatium", _spatium / MScore::DPMM);
|
|
|
|
xml.etag();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// chordDescription
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
const ChordDescription* StyleData::chordDescription(int id) const
|
|
|
|
{
|
2014-03-15 12:15:49 +01:00
|
|
|
if (!_chordList.contains(id))
|
|
|
|
return 0;
|
|
|
|
return &*_chordList.find(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
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2014-07-03 11:22:42 +02:00
|
|
|
const TextStyle& StyleData::textStyle(TextStyleType idx) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2014-07-03 11:22:42 +02:00
|
|
|
Q_ASSERT(int(idx) >= 0 && int(idx) < _textStyles.count());
|
|
|
|
return _textStyles[int(idx)];
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// value
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-08-09 11:42:24 +02:00
|
|
|
QVariant MStyle::value(StyleIdx idx) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2014-05-26 15:31:36 +02:00
|
|
|
return d->_values[int(idx)];
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2014-03-04 13:06:23 +01:00
|
|
|
qFatal("TextStyle <%s> not found", qPrintable(name));
|
2012-05-26 14:26:10 +02:00
|
|
|
return _textStyles[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2014-07-03 11:22:42 +02:00
|
|
|
TextStyleType StyleData::textStyleType(const QString& name) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
for (int i = 0; i < _textStyles.size(); ++i) {
|
|
|
|
if (_textStyles[i].name() == name)
|
2014-07-03 11:22:42 +02:00
|
|
|
return TextStyleType(i);
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
2013-02-12 20:51:17 +01:00
|
|
|
if (name == "Dynamics2")
|
2014-05-30 10:13:29 +02:00
|
|
|
return TextStyleType::DYNAMICS;
|
2012-05-26 14:26:10 +02:00
|
|
|
qDebug("TextStyleType <%s> not found", qPrintable(name));
|
2014-05-30 10:13:29 +02:00
|
|
|
return TextStyleType::DEFAULT;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// 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::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); }
|
2014-03-14 11:30:19 +01:00
|
|
|
void TextStyle::writeProperties(Xml& xml, const TextStyle& r) const { d->writeProperties(xml, *r.d); }
|
2014-03-14 16:16:43 +01:00
|
|
|
void TextStyle::restyle(const TextStyle& os, const TextStyle& ns) { d->restyle(*os.d, *ns.d); }
|
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
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// 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
|
|
|
{
|
2014-05-26 15:31:36 +02:00
|
|
|
d->_values[int(id)] = v;
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2014-07-03 11:22:42 +02:00
|
|
|
const TextStyle& MStyle::textStyle(TextStyleType idx) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
return d->textStyle(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TextStyle& MStyle::textStyle(const QString& name) const
|
|
|
|
{
|
|
|
|
return d->textStyle(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// textStyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2014-07-03 11:22:42 +02:00
|
|
|
TextStyleType MStyle::textStyleType(const QString& name) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-06-26 10:53:57 +02:00
|
|
|
void MStyle::set(StyleIdx t, MScore::Direction val)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2014-05-07 18:09:01 +02:00
|
|
|
set(t, QVariant(int(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('.');
|
2013-08-29 20:20:39 +02:00
|
|
|
int mscVersion = sl[0].toInt() * 100 + sl[1].toInt();
|
|
|
|
if (mscVersion != MSCVERSION)
|
|
|
|
return false;
|
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();
|
|
|
|
}
|
|
|
|
|
2014-12-28 18:20:12 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// pageFormat
|
|
|
|
//---------------------------------------------------------
|
|
|
|
PageFormat* MStyle::pageFormat()
|
|
|
|
{
|
|
|
|
return d->pageFormat();
|
|
|
|
}
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// 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
|
|
|
}
|
|
|
|
|