void TestMidi::midi3() { MCursor c; c.createScore("test3a"); c.addPart("voice"); c.move(0, 0); // move to track 0 tick 0 c.addKeySig(1); c.addTimeSig(Fraction(4,4)); c.addChord(60, TDuration(TDuration::V_QUARTER)); c.addChord(61, TDuration(TDuration::V_QUARTER)); c.addChord(62, TDuration(TDuration::V_QUARTER)); c.addChord(63, TDuration(TDuration::V_QUARTER)); Score* score = c.score(); score->doLayout(); score->rebuildMidiMapping(); c.saveScore(); saveMidi(score, "test3.mid"); Score* score2 = new Score(mscore->baseStyle()); score2->setName("test3b"); QVERIFY(importMidi(score2, "test3.mid")); score2->doLayout(); score2->rebuildMidiMapping(); MCursor c2(score2); c2.saveScore(); QVERIFY(compareScores(score, score2)); delete score; delete score2; }
static int headType(int tickLen, TDuration* type) { if (tickLen == 0) { *type = TDuration(TDuration::V_MEASURE); return 0; } TDuration dt; for (int i = 0; i < TDuration::V_ZERO; ++i) { dt.setType(TDuration::DurationType(i)); int ticks = dt.ticks(); if (tickLen / ticks) { int remain = tickLen % ticks; if ((ticks - remain) < (ticks/4)) { *type = TDuration(TDuration::DurationType(i-1)); return 0; } *type = dt; int dots; int rest = getDots(ticks, remain, &dots); dt.setDots(dots); return rest; } } qDebug("1: no duration type for ticks %d", tickLen); *type = TDuration(TDuration::V_QUARTER); return 0; }
void StaffTextBase::write(XmlWriter& xml) const { if (!xml.canWrite(this)) return; xml.stag(name()); for (ChannelActions s : _channelActions) { int channel = s.channel; for (QString name : s.midiActionNames) xml.tagE(QString("MidiAction channel=\"%1\" name=\"%2\"").arg(channel).arg(name)); } for (int voice = 0; voice < VOICES; ++voice) { if (!_channelNames[voice].isEmpty()) xml.tagE(QString("channelSwitch voice=\"%1\" name=\"%2\"").arg(voice).arg(_channelNames[voice])); } if (_setAeolusStops) { for (int i = 0; i < 4; ++i) xml.tag(QString("aeolus group=\"%1\"").arg(i), aeolusStops[i]); } if (swing()) { QString swingUnit; if (swingParameters()->swingUnit == MScore::division / 2) swingUnit = TDuration(TDuration::DurationType::V_EIGHTH).name(); else if (swingParameters()->swingUnit == MScore::division / 4) swingUnit = TDuration(TDuration::DurationType::V_16TH).name(); else swingUnit = TDuration(TDuration::DurationType::V_ZERO).name(); int swingRatio = swingParameters()->swingRatio; xml.tagE(QString("swing unit=\"%1\" ratio= \"%2\"").arg(swingUnit).arg(swingRatio)); } TextBase::writeProperties(xml); xml.etag(); }
TDuration TDuration::shift(int v) const { if (_val == DurationType::V_MEASURE || _val == DurationType::V_INVALID || _val == DurationType::V_ZERO) return TDuration(); int newValue = int(_val) + v; if ((newValue < int(DurationType::V_LONG)) || (newValue > int(DurationType::V_256TH))) return TDuration(); return TDuration(DurationType(newValue)); }
TDuration TDuration::shift(int v) const { if (_val == V_MEASURE || _val == V_INVALID || _val == V_ZERO) return TDuration(); int newValue = _val + v; if ((newValue < 0) || (newValue > V_256TH)) return TDuration(); return TDuration(DurationType(newValue)); }
void Cursor::setDuration(int z, int n) { TDuration d(Fraction(z, n)); if (!d.isValid()) d = TDuration(TDuration::DurationType::V_QUARTER); score()->inputState().setDuration(d); }
void EditStyle::setSwingParams(bool checked) { if( !checked) return; if (SwingOff->isChecked()) { lstyle.set(StyleIdx::swingUnit, TDuration(TDuration::DurationType::V_ZERO).name()); swingBox->setEnabled(false); } else if (swingEighth->isChecked()) { lstyle.set(StyleIdx::swingUnit, TDuration(TDuration::DurationType::V_EIGHT).name()); swingBox->setEnabled(true); } else if (swingSixteenth->isChecked()) { lstyle.set(StyleIdx::swingUnit, TDuration(TDuration::DurationType::V_16TH).name()); swingBox->setEnabled(true); } }
QList<TDuration> toDurationList(Fraction l, bool useDottedValues) { QList<TDuration> dList; if (useDottedValues) { for (TDuration d = TDuration(TDuration::V_LONG); d.isValid() && (l.numerator() != 0);) { d.setDots(2); Fraction ff(l - d.fraction()); if (ff.numerator() >= 0) { dList.append(d); l -= d.fraction(); continue; } d.setDots(1); ff = l - d.fraction(); if (ff.numerator() >= 0) { dList.append(d); l -= d.fraction(); continue; } d.setDots(0); ff = l - d.fraction(); if (ff.numerator() < 0) { d = d.shift(1); } else { l -= d.fraction(); dList.append(d); } } } else { for (TDuration d = TDuration(TDuration::V_LONG); d.isValid() && (l.numerator() != 0);) { Fraction ff(l - d.fraction()); if (ff.numerator() < 0) { d = d.shift(1); continue; } l -= d.fraction(); dList.append(d); } } if (l != Fraction()) qDebug("toDurationList:: rest remains %d/%d", l.numerator(), l.denominator()); return dList; }
std::vector<TDuration> toDurationList(Fraction l, bool useDots, int maxDots, bool printRestRemains) { std::vector<TDuration> dList; dList.reserve(8); if (useDots) { for (TDuration d = TDuration(TDuration::DurationType::V_LONG); d.isValid() && (l.numerator() != 0);) { int dots = maxDots; for ( ; dots > 0; --dots) { d.setDots(dots); Fraction ff = l - d.fraction(); if (ff.numerator() >= 0) { dList.push_back(d); l -= d.fraction(); break; } } if (dots > 0) continue; d.setDots(0); Fraction ff = l - d.fraction(); if (ff.numerator() < 0) d = d.shift(1); else { dList.push_back(d); l -= d.fraction(); } } } else { for (TDuration d = TDuration(TDuration::DurationType::V_LONG); d.isValid() && (l.numerator() != 0);) { Fraction ff(l - d.fraction()); if (ff.numerator() < 0) { d = d.shift(1); continue; } l -= d.fraction(); dList.push_back(d); } } if (printRestRemains && l != Fraction()) qDebug("toDurationList:: rest remains %d/%d", l.numerator(), l.denominator()); return dList; }
QList<TDuration> toDurationList(Fraction l, bool useDots, int maxDots) { QList<TDuration> dList; if (useDots) { for (TDuration d = TDuration(TDuration::V_LONG); d.isValid() && (l.numerator() != 0);) { int dots = maxDots; for ( ; dots > 0; --dots) { d.setDots(dots); Fraction ff = l - d.fraction(); if (ff.numerator() >= 0) { dList.append(d); l -= d.fraction(); break; } } if (dots > 0) continue; d.setDots(0); Fraction ff = l - d.fraction(); if (ff.numerator() < 0) { d = d.shift(1); } else { dList.append(d); l -= d.fraction(); } } } else { for (TDuration d = TDuration(TDuration::V_LONG); d.isValid() && (l.numerator() != 0);) { Fraction ff(l - d.fraction()); if (ff.numerator() < 0) { d = d.shift(1); continue; } l -= d.fraction(); dList.append(d); } } if (l != Fraction()) qDebug("toDurationList:: rest remains %d/%d", l.numerator(), l.denominator()); return dList; }
int TempoText::findTempoDuration(const QString& s, int& len, TDuration& dur) { len = 0; dur = TDuration(); for (const auto& i : tp) { QRegExp re(i.pattern); int pos = re.indexIn(s); if (pos != -1) { len = re.matchedLength(); dur = i.d; return pos; } } return -1; }
int TempoText::findTempoDuration(const QString& s, int& len, TDuration& dur) { len = 0; dur = TDuration(); for (unsigned i = 0; i < sizeof(tp)/sizeof(*tp); ++i) { QRegExp re(tp[i].pattern); int pos = re.indexIn(s); if (pos != -1) { len = re.matchedLength(); dur = tp[i].d; return pos; } } return -1; }
void EditStyle::getValues() { lstyle.set(StyleIdx::staffUpperBorder, Spatium(staffUpperBorder->value())); lstyle.set(StyleIdx::staffLowerBorder, Spatium(staffLowerBorder->value())); lstyle.set(StyleIdx::staffDistance, Spatium(staffDistance->value())); lstyle.set(StyleIdx::akkoladeDistance, Spatium(akkoladeDistance->value())); lstyle.set(StyleIdx::minSystemDistance, Spatium(minSystemDistance->value())); lstyle.set(StyleIdx::maxSystemDistance, Spatium(maxSystemDistance->value())); lstyle.set(StyleIdx::lyricsDistance, Spatium(lyricsDistance->value())); lstyle.set(StyleIdx::lyricsMinBottomDistance, Spatium(lyricsMinBottomDistance->value())); lstyle.set(StyleIdx::lyricsLineHeight, Spatium(lyricsLineHeight->value() * .01)); lstyle.set(StyleIdx::systemFrameDistance, Spatium(systemFrameDistance->value())); lstyle.set(StyleIdx::frameSystemDistance, Spatium(frameSystemDistance->value())); lstyle.set(StyleIdx::minMeasureWidth, Spatium(minMeasureWidth_2->value())); lstyle.set(StyleIdx::barWidth, Spatium(barWidth->value())); lstyle.set(StyleIdx::endBarWidth, Spatium(endBarWidth->value())); lstyle.set(StyleIdx::endBarDistance, Spatium(endBarDistance->value())); lstyle.set(StyleIdx::doubleBarWidth, Spatium(doubleBarWidth->value())); lstyle.set(StyleIdx::doubleBarDistance, Spatium(doubleBarDistance->value())); lstyle.set(StyleIdx::repeatBarTips, showRepeatBarTips->isChecked()); lstyle.set(StyleIdx::startBarlineSingle, showStartBarlineSingle->isChecked()); lstyle.set(StyleIdx::startBarlineMultiple, showStartBarlineMultiple->isChecked()); lstyle.set(StyleIdx::measureSpacing, measureSpacing->value()); lstyle.set(StyleIdx::minNoteDistance, Spatium(minNoteDistance->value())); lstyle.set(StyleIdx::barNoteDistance, Spatium(barNoteDistance->value())); lstyle.set(StyleIdx::barAccidentalDistance, Spatium(barAccidentalDistance->value())); lstyle.set(StyleIdx::multiMeasureRestMargin, Spatium(multiMeasureRestMargin->value())); lstyle.set(StyleIdx::noteBarDistance, Spatium(noteBarDistance->value())); lstyle.set(StyleIdx::showMeasureNumber, showMeasureNumber->isChecked()); lstyle.set(StyleIdx::showMeasureNumberOne, showFirstMeasureNumber->isChecked()); lstyle.set(StyleIdx::measureNumberInterval, intervalMeasureNumber->value()); lstyle.set(StyleIdx::measureNumberSystem, showEverySystemMeasureNumber->isChecked()); lstyle.set(StyleIdx::measureNumberAllStaffs, showAllStaffsMeasureNumber->isChecked()); lstyle.set(StyleIdx::clefLeftMargin, Spatium(clefLeftMargin->value())); lstyle.set(StyleIdx::keysigLeftMargin, Spatium(keysigLeftMargin->value())); lstyle.set(StyleIdx::timesigLeftMargin, Spatium(timesigLeftMargin->value())); lstyle.set(StyleIdx::clefKeyRightMargin, Spatium(clefKeyRightMargin->value())); lstyle.set(StyleIdx::clefBarlineDistance, Spatium(clefBarlineDistance->value())); lstyle.set(StyleIdx::staffLineWidth, Spatium(staffLineWidth->value())); lstyle.set(StyleIdx::beamWidth, Spatium(beamWidth->value())); lstyle.set(StyleIdx::beamDistance, beamDistance->value() / 100.0); lstyle.set(StyleIdx::beamMinLen, Spatium(beamMinLen->value())); lstyle.set(StyleIdx::beamNoSlope, beamNoSlope->isChecked()); lstyle.set(StyleIdx::graceNoteMag, graceNoteSize->value() / 100.0); lstyle.set(StyleIdx::smallStaffMag, smallStaffSize->value() / 100.0); lstyle.set(StyleIdx::smallNoteMag, smallNoteSize->value() / 100.0); lstyle.set(StyleIdx::smallClefMag, smallClefSize->value() / 100.0); lstyle.set(StyleIdx::lastSystemFillLimit, lastSystemFillThreshold->value() / 100.0); lstyle.set(StyleIdx::hairpinY, Spatium(hairpinY->value())); lstyle.set(StyleIdx::hairpinLineWidth, Spatium(hairpinLineWidth->value())); lstyle.set(StyleIdx::hairpinHeight, Spatium(hairpinHeight->value())); lstyle.set(StyleIdx::hairpinContHeight, Spatium(hairpinContinueHeight->value())); lstyle.set(StyleIdx::genClef, genClef->isChecked()); lstyle.set(StyleIdx::genKeysig, genKeysig->isChecked()); lstyle.set(StyleIdx::genTimesig, genTimesig->isChecked()); lstyle.set(StyleIdx::genCourtesyTimesig, genCourtesyTimesig->isChecked()); lstyle.set(StyleIdx::genCourtesyKeysig, genCourtesyKeysig->isChecked()); lstyle.set(StyleIdx::genCourtesyClef, genCourtesyClef->isChecked()); lstyle.set(StyleIdx::swingRatio, swingBox->value()); if (swingEighth->isChecked()) lstyle.set(StyleIdx::swingUnit, QString(TDuration(TDuration::DurationType::V_EIGHT).name())); else if (swingSixteenth->isChecked()) lstyle.set(StyleIdx::swingUnit, QString(TDuration(TDuration::DurationType::V_16TH).name())); else if (SwingOff->isChecked()) lstyle.set(StyleIdx::swingUnit, QString(TDuration(TDuration::DurationType::V_ZERO).name())); bool customChords = false; if (chordsStandard->isChecked()) lstyle.set(StyleIdx::chordStyle, QString("std")); else if (chordsJazz->isChecked()) lstyle.set(StyleIdx::chordStyle, QString("jazz")); else { lstyle.set(StyleIdx::chordStyle, QString("custom")); customChords = true; } lstyle.set(StyleIdx::chordsXmlFile, chordsXmlFile->isChecked()); if (lstyle.value(StyleIdx::chordDescriptionFile).toString() != chordDescriptionFile->text()) { ChordList* cl = new ChordList(); if (lstyle.value(StyleIdx::chordsXmlFile).toBool()) cl->read("chords.xml"); cl->read(chordDescriptionFile->text()); lstyle.setChordList(cl, customChords); lstyle.set(StyleIdx::chordDescriptionFile, chordDescriptionFile->text()); } lstyle.set(StyleIdx::useStandardNoteNames, useStandardNoteNames->isChecked()); lstyle.set(StyleIdx::useGermanNoteNames, useGermanNoteNames->isChecked()); lstyle.set(StyleIdx::useSolfeggioNoteNames, useSolfeggioNoteNames->isChecked()); lstyle.set(StyleIdx::lowerCaseMinorChords, lowerCaseMinorChords->isChecked()); lstyle.set(StyleIdx::concertPitch, concertPitch->isChecked()); lstyle.set(StyleIdx::createMultiMeasureRests, multiMeasureRests->isChecked()); lstyle.set(StyleIdx::minEmptyMeasures, minEmptyMeasures->value()); lstyle.set(StyleIdx::minMMRestWidth, Spatium(minMeasureWidth->value())); lstyle.set(StyleIdx::hideEmptyStaves, hideEmptyStaves->isChecked()); lstyle.set(StyleIdx::dontHideStavesInFirstSystem, dontHideStavesInFirstSystem->isChecked()); lstyle.set(StyleIdx::hideInstrumentNameIfOneInstrument, hideInstrumentNameIfOneInstrument->isChecked()); lstyle.set(StyleIdx::accidentalNoteDistance, Spatium(accidentalNoteDistance->value())); lstyle.set(StyleIdx::accidentalDistance, Spatium(accidentalDistance->value())); lstyle.set(StyleIdx::dotMag, dotMag->value() / 100.0); lstyle.set(StyleIdx::dotNoteDistance, Spatium(noteDotDistance->value())); lstyle.set(StyleIdx::dotDotDistance, Spatium(dotDotDistance->value())); lstyle.set(StyleIdx::stemWidth, Spatium(stemWidth->value())); lstyle.set(StyleIdx::ledgerLineWidth, Spatium(ledgerLineWidth->value())); lstyle.set(StyleIdx::ledgerLineLength, Spatium(ledgerLineLength->value())); lstyle.set(StyleIdx::bracketWidth, Spatium(bracketWidth->value())); lstyle.set(StyleIdx::bracketDistance, Spatium(bracketDistance->value())); lstyle.set(StyleIdx::akkoladeWidth, Spatium(akkoladeWidth->value())); lstyle.set(StyleIdx::akkoladeBarDistance, Spatium(akkoladeBarDistance->value())); lstyle.set(StyleIdx::propertyDistanceHead, Spatium(propertyDistanceHead->value())); lstyle.set(StyleIdx::propertyDistanceStem, Spatium(propertyDistanceStem->value())); lstyle.set(StyleIdx::propertyDistance, Spatium(propertyDistance->value())); lstyle.set(StyleIdx::articulationMag, articulationMag->value() / 100.0); lstyle.set(StyleIdx::shortenStem, shortenStem->isChecked()); lstyle.set(StyleIdx::shortStemProgression, Spatium(shortStemProgression->value())); lstyle.set(StyleIdx::shortestStem, Spatium(shortestStem->value())); lstyle.set(StyleIdx::ArpeggioNoteDistance, Spatium(arpeggioNoteDistance->value())); lstyle.set(StyleIdx::ArpeggioLineWidth, Spatium(arpeggioLineWidth->value())); lstyle.set(StyleIdx::ArpeggioHookLen, Spatium(arpeggioHookLen->value())); lstyle.set(StyleIdx::FixMeasureNumbers, fixNumberMeasures->value()); lstyle.set(StyleIdx::FixMeasureWidth, fixMeasureWidth->isChecked()); lstyle.set(StyleIdx::SlurEndWidth, Spatium(slurEndLineWidth->value())); lstyle.set(StyleIdx::SlurMidWidth, Spatium(slurMidLineWidth->value())); lstyle.set(StyleIdx::SlurDottedWidth, Spatium(slurDottedLineWidth->value())); lstyle.set(StyleIdx::MinTieLength, Spatium(minTieLength->value())); int idx1 = musicalSymbolFont->itemData(musicalSymbolFont->currentIndex()).toInt(); lstyle.set(StyleIdx::MusicalSymbolFont, ScoreFont::scoreFonts().at(idx1).name()); QString tf = musicalTextFont->itemData(musicalTextFont->currentIndex()).toString(); lstyle.set(StyleIdx::MusicalTextFont, tf); lstyle.set(StyleIdx::showHeader, showHeader->isChecked()); lstyle.set(StyleIdx::headerFirstPage, showHeaderFirstPage->isChecked()); lstyle.set(StyleIdx::headerOddEven, headerOddEven->isChecked()); Text t(cs); t.setTextStyleType(TextStyleType::HEADER); lstyle.set(StyleIdx::evenHeaderL, t.convertFromHtml(evenHeaderL->toHtml())); lstyle.set(StyleIdx::evenHeaderC, t.convertFromHtml(evenHeaderC->toHtml())); lstyle.set(StyleIdx::evenHeaderR, t.convertFromHtml(evenHeaderR->toHtml())); lstyle.set(StyleIdx::oddHeaderL, t.convertFromHtml(oddHeaderL->toHtml())); lstyle.set(StyleIdx::oddHeaderC, t.convertFromHtml(oddHeaderC->toHtml())); lstyle.set(StyleIdx::oddHeaderR, t.convertFromHtml(oddHeaderR->toHtml())); lstyle.set(StyleIdx::showFooter, showFooter->isChecked()); lstyle.set(StyleIdx::footerFirstPage, showFooterFirstPage->isChecked()); lstyle.set(StyleIdx::footerOddEven, footerOddEven->isChecked()); t.setTextStyleType(TextStyleType::FOOTER); lstyle.set(StyleIdx::evenFooterL, t.convertFromHtml(evenFooterL->toHtml())); lstyle.set(StyleIdx::evenFooterC, t.convertFromHtml(evenFooterC->toHtml())); lstyle.set(StyleIdx::evenFooterR, t.convertFromHtml(evenFooterR->toHtml())); lstyle.set(StyleIdx::oddFooterL, t.convertFromHtml(oddFooterL->toHtml())); lstyle.set(StyleIdx::oddFooterC, t.convertFromHtml(oddFooterC->toHtml())); lstyle.set(StyleIdx::oddFooterR, t.convertFromHtml(oddFooterR->toHtml())); // figured bass int idx = comboFBFont->currentIndex(); QString family; if(FiguredBass::fontData(idx, &family, 0, 0, 0)) lstyle.set(StyleIdx::figuredBassFontFamily, family); qreal size = doubleSpinFBSize->value(); qreal vPos = doubleSpinFBVertPos->value(); lstyle.set(StyleIdx::figuredBassFontSize, size); lstyle.set(StyleIdx::figuredBassYOffset, vPos); lstyle.set(StyleIdx::figuredBassLineHeight, ((double)spinFBLineHeight->value()) / 100.0); lstyle.set(StyleIdx::figuredBassAlignment, radioFBTop->isChecked() ? 0 : 1); lstyle.set(StyleIdx::figuredBassStyle, radioFBModern->isChecked() ? 0 : 1); // copy to text style data relevant to it (LineHeight and Style are not in text style); // offsetType is necessarily OFFSET_SPATIUM const TextStyle fbOld = lstyle.textStyle(TextStyleType::FIGURED_BASS); if (family != fbOld.family() || size != fbOld.size() || vPos != fbOld.offset().y() || fbOld.offsetType() != OffsetType::SPATIUM) { TextStyle fbNew(fbOld); fbNew.setFamily(family); fbNew.setSize(size); fbNew.setYoff(vPos); fbNew.setOffsetType(OffsetType::SPATIUM); lstyle.setTextStyle(fbNew); } for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i) { QComboBox* cb = static_cast<QComboBox*>(articulationTable->cellWidget(i, 1)); lstyle.setArticulationAnchor(i, ArticulationAnchor(cb->itemData(cb->currentIndex()).toInt())); } lstyle.set(StyleIdx::voltaY, Spatium(voltaY->value())); lstyle.set(StyleIdx::voltaHook, Spatium(voltaHook->value())); lstyle.set(StyleIdx::voltaLineWidth, Spatium(voltaLineWidth->value())); lstyle.set(StyleIdx::voltaLineStyle, voltaLineStyle->currentIndex() + 1); lstyle.set(StyleIdx::ottavaY, Spatium(ottavaY->value())); lstyle.set(StyleIdx::ottavaHook, Spatium(ottavaHook->value())); lstyle.set(StyleIdx::ottavaLineWidth, Spatium(ottavaLineWidth->value())); lstyle.set(StyleIdx::ottavaLineStyle, ottavaLineStyle->currentIndex() + 1); lstyle.set(StyleIdx::ottavaNumbersOnly, ottavaNumbersOnly->isChecked()); lstyle.set(StyleIdx::pedalY, Spatium(pedalY->value())); lstyle.set(StyleIdx::pedalLineWidth, Spatium(pedalLineWidth->value())); lstyle.set(StyleIdx::pedalLineStyle, pedalLineStyle->currentIndex() + 1); lstyle.set(StyleIdx::trillY, Spatium(trillY->value())); lstyle.set(StyleIdx::harmonyY, Spatium(harmonyY->value())); lstyle.set(StyleIdx::harmonyFretDist, Spatium(harmonyFretDist->value())); lstyle.set(StyleIdx::minHarmonyDistance, Spatium(minHarmonyDistance->value())); lstyle.set(StyleIdx::maxHarmonyBarDistance, Spatium(maxHarmonyBarDistance->value())); lstyle.set(StyleIdx::capoPosition, capoPosition->value()); lstyle.set(StyleIdx::fretNumMag, fretNumMag->value()*0.01); lstyle.set(StyleIdx::fretNumPos, radioFretNumLeft->isChecked() ? 0 : 1); lstyle.set(StyleIdx::fretY, fretY->value()); lstyle.set(StyleIdx::tabClef, int(clefTab1->isChecked() ? ClefType::TAB : ClefType::TAB2)); lstyle.set(StyleIdx::crossMeasureValues, crossMeasureValues->isChecked()); lstyle.set(StyleIdx::keySigNaturals, radioKeySigNatNone->isChecked() ? int(KeySigNatural::NONE) : (radioKeySigNatBefore->isChecked() ? int(KeySigNatural::BEFORE) : int(KeySigNatural::AFTER)) ); lstyle.set(StyleIdx::tupletMaxSlope, tupletMaxSlope->value()); lstyle.set(StyleIdx::tupletOufOfStaff, tupletOutOfStaff->isChecked()); lstyle.set(StyleIdx::tupletVHeadDistance, Spatium(tupletVHeadDistance->value())); lstyle.set(StyleIdx::tupletVStemDistance, Spatium(tupletVStemDistance->value())); lstyle.set(StyleIdx::tupletStemLeftDistance, Spatium(tupletStemLeftDistance->value())); lstyle.set(StyleIdx::tupletStemRightDistance, Spatium(tupletStemRightDistance->value())); lstyle.set(StyleIdx::tupletNoteLeftDistance, Spatium(tupletNoteLeftDistance->value())); lstyle.set(StyleIdx::tupletNoteRightDistance, Spatium(tupletNoteRightDistance->value())); }
void Rest::layout() { _space.setLw(0.0); if (parent() && measure() && measure()->isMMRest()) { _space.setRw(point(score()->styleS(StyleIdx::minMMRestWidth))); static const qreal verticalLineWidth = .2; qreal _spatium = spatium(); qreal h = _spatium * (2 + verticalLineWidth); qreal w = _mmWidth + _spatium * verticalLineWidth*.5; bbox().setRect(-_spatium * verticalLineWidth*.5, -h * .5, w, h); // text qreal y = -_spatium * 2.5 - staff()->height() *.5; addbbox(QRectF(0, y, w, _spatium * 2)); // approximation return; } rxpos() = 0.0; if (staff() && staff()->isTabStaff()) { StaffType* tab = staff()->staffType(); // if rests are shown and note values are shown as duration symbols if (tab->showRests() && tab->genDurations()) { TDuration::DurationType type = durationType().type(); int dots = durationType().dots(); // if rest is whole measure, convert into actual type and dot values if (type == TDuration::DurationType::V_MEASURE) { int ticks = measure()->ticks(); TDuration dur = TDuration(Fraction::fromTicks(ticks)).type(); type = dur.type(); dots = dur.dots(); } // symbol needed; if not exist, create, if exists, update duration if (!_tabDur) _tabDur = new TabDurationSymbol(score(), tab, type, dots); else _tabDur->setDuration(type, dots, tab); _tabDur->setParent(this); // needed? _tabDur->setTrack(track()); _tabDur->layout(); setbbox(_tabDur->bbox()); setPos(0.0, 0.0); // no rest is drawn: reset any position might be set for it _space.setLw(0.0); _space.setRw(width()); return; } // if no rests or no duration symbols, delete any dur. symbol and chain into standard staff mngmt // this is to ensure horiz space is reserved for rest, even if they are not diplayed // Rest::draw() will skip their drawing, if not needed if(_tabDur) { delete _tabDur; _tabDur = 0; } } switch(durationType().type()) { case TDuration::DurationType::V_64TH: case TDuration::DurationType::V_32ND: dotline = -3; break; case TDuration::DurationType::V_1024TH: case TDuration::DurationType::V_512TH: case TDuration::DurationType::V_256TH: case TDuration::DurationType::V_128TH: dotline = -5; break; default: dotline = -1; break; } qreal _spatium = spatium(); int stepOffset = 0; if (staff()) stepOffset = staff()->staffType()->stepOffset(); int line = lrint(userOff().y() / _spatium); // + ((staff()->lines()-1) * 2); qreal lineDist = staff() ? staff()->staffType()->lineDistance().val() : 1.0; int lines = staff() ? staff()->lines() : 5; int lineOffset = computeLineOffset(); int yo; _sym = getSymbol(durationType().type(), line + lineOffset/2, lines, &yo); layoutArticulations(); rypos() = (qreal(yo) + qreal(lineOffset + stepOffset) * .5) * lineDist * _spatium; Spatium rs; if (dots()) { rs = Spatium(score()->styleS(StyleIdx::dotNoteDistance) + dots() * score()->styleS(StyleIdx::dotDotDistance)); } if (dots()) { rs = Spatium(score()->styleS(StyleIdx::dotNoteDistance) + dots() * score()->styleS(StyleIdx::dotDotDistance)); } setbbox(symBbox(_sym)); _space.setRw(width() + point(rs)); }
bool ChordRest::readProperties(XmlReader& e) { const QStringRef& tag(e.name()); if (tag == "durationType") { setDurationType(e.readElementText()); if (actualDurationType().type() != TDuration::DurationType::V_MEASURE) { if ((type() == Element::Type::REST) && // for backward compatibility, convert V_WHOLE rests to V_MEASURE // if long enough to fill a measure. // OTOH, freshly created (un-initialized) rests have numerator == 0 (< 4/4) // (see Fraction() constructor in fraction.h; this happens for instance // when pasting selection from clipboard): they should not be converted duration().numerator() != 0 && // rest durations are initialized to full measure duration when // created upon reading the <Rest> tag (see Measure::read() ) // so a V_WHOLE rest in a measure of 4/4 or less => V_MEASURE (actualDurationType()==TDuration::DurationType::V_WHOLE && duration() <= Fraction(4, 4)) ) { // old pre 2.0 scores: convert setDurationType(TDuration::DurationType::V_MEASURE); } else // not from old score: set duration fraction from duration type setDuration(actualDurationType().fraction()); } else { if (score()->mscVersion() < 115) { SigEvent event = score()->sigmap()->timesig(e.tick()); setDuration(event.timesig()); } } } else if (tag == "BeamMode") { QString val(e.readElementText()); Beam::Mode bm = Beam::Mode::AUTO; if (val == "auto") bm = Beam::Mode::AUTO; else if (val == "begin") bm = Beam::Mode::BEGIN; else if (val == "mid") bm = Beam::Mode::MID; else if (val == "end") bm = Beam::Mode::END; else if (val == "no") bm = Beam::Mode::NONE; else if (val == "begin32") bm = Beam::Mode::BEGIN32; else if (val == "begin64") bm = Beam::Mode::BEGIN64; else bm = Beam::Mode(val.toInt()); _beamMode = Beam::Mode(bm); } else if (tag == "Attribute" || tag == "Articulation") { // obsolete: "Attribute" Articulation* atr = new Articulation(score()); atr->read(e); add(atr); } else if (tag == "leadingSpace") { qDebug("ChordRest: leadingSpace obsolete"); // _extraLeadingSpace = Spatium(val.toDouble()); e.skipCurrentElement(); } else if (tag == "trailingSpace") { qDebug("ChordRest: trailingSpace obsolete"); // _extraTrailingSpace = Spatium(val.toDouble()); e.skipCurrentElement(); } else if (tag == "Beam") { int id = e.readInt(); Beam* beam = e.findBeam(id); if (beam) beam->add(this); // also calls this->setBeam(beam) else qDebug("Beam id %d not found", id); } else if (tag == "small") _small = e.readInt(); else if (tag == "duration") setDuration(e.readFraction()); else if (tag == "ticklen") { // obsolete (version < 1.12) int mticks = score()->sigmap()->timesig(e.tick()).timesig().ticks(); int i = e.readInt(); if (i == 0) i = mticks; if ((type() == Element::Type::REST) && (mticks == i)) { setDurationType(TDuration::DurationType::V_MEASURE); setDuration(Fraction::fromTicks(i)); } else { Fraction f = Fraction::fromTicks(i); setDuration(f); setDurationType(TDuration(f)); } } else if (tag == "dots") setDots(e.readInt()); else if (tag == "move") _staffMove = e.readInt(); else if (tag == "Slur") { int id = e.intAttribute("id"); if (id == 0) id = e.intAttribute("number"); // obsolete Spanner* spanner = e.findSpanner(id); if (!spanner) qDebug("ChordRest::read(): Slur id %d not found", id); else { QString atype(e.attribute("type")); if (atype == "start") { spanner->setTick(e.tick()); if (spanner->ticks() > 0) // stop has been read first, ticks is tick2 - (-1) spanner->setTick2(spanner->ticks() - 1); spanner->setTrack(track()); if (spanner->type() == Element::Type::SLUR) spanner->setStartElement(this); if (e.pasteMode()) { for (Element* e : spanner->linkList()) { if (e == spanner) continue; Spanner* ls = static_cast<Spanner*>(e); ls->setTick(spanner->tick()); for (Element* ee : linkList()) { ChordRest* cr = static_cast<ChordRest*>(ee); if (cr->score() == ee->score() && cr->staffIdx() == ls->staffIdx()) { ls->setTrack(cr->track()); if (ls->type() == Element::Type::SLUR) ls->setStartElement(cr); break; } } } } } else if (atype == "stop") { spanner->setTick2(e.tick()); spanner->setTrack2(track()); if (spanner->type() == Element::Type::SLUR) spanner->setEndElement(this); Chord* start = static_cast<Chord*>(spanner->startElement()); if (start) spanner->setTrack(start->track()); if (e.pasteMode()) { for (Element* e : spanner->linkList()) { if (e == spanner) continue; Spanner* ls = static_cast<Spanner*>(e); ls->setTick2(spanner->tick2()); for (Element* ee : linkList()) { ChordRest* cr = static_cast<ChordRest*>(ee); if (cr->score() == ee->score() && cr->staffIdx() == ls->staffIdx()) { ls->setTrack2(cr->track()); if (ls->type() == Element::Type::SLUR) ls->setEndElement(cr); break; } } } } } else qDebug("ChordRest::read(): unknown Slur type <%s>", qPrintable(atype)); } e.readNext(); } else if (tag == "Lyrics" /*|| tag == "FiguredBass"*/) { Element* element = Element::name2Element(tag, score()); element->setTrack(e.track()); element->read(e); add(element); } else if (tag == "pos") { QPointF pt = e.readPoint(); if (score()->mscVersion() > 114) setUserOff(pt * spatium()); } else if (tag == "offset") { if (score()->mscVersion() > 114) // || voice() >= 2) { DurationElement::readProperties(e); else if (type() == Element::Type::REST) { DurationElement::readProperties(e); setUserXoffset(0.0); // honor Y offset but not X for rests in older scores } else e.skipCurrentElement(); // ignore manual layout otherwise } else if (DurationElement::readProperties(e)) return true; else return false; return true; }
bool StaffTextBase::readProperties(XmlReader& e) { const QStringRef& tag(e.name()); if (tag == "MidiAction") { int channel = e.intAttribute("channel", 0); QString name = e.attribute("name"); bool found = false; int n = _channelActions.size(); for (int i = 0; i < n; ++i) { ChannelActions* a = &_channelActions[i]; if (a->channel == channel) { a->midiActionNames.append(name); found = true; break; } } if (!found) { ChannelActions a; a.channel = channel; a.midiActionNames.append(name); _channelActions.append(a); } e.readNext(); } else if (tag == "channelSwitch" || tag == "articulationChange") { int voice = e.intAttribute("voice", -1); if (voice >= 0 && voice < VOICES) _channelNames[voice] = e.attribute("name"); else if (voice == -1) { // no voice applies channel to all voices for // compatibility for (int i = 0; i < VOICES; ++i) _channelNames[i] = e.attribute("name"); } e.readNext(); } else if (tag == "aeolus") { int group = e.intAttribute("group", -1); if (group >= 0 && group < 4) aeolusStops[group] = e.readInt(); else e.readNext(); _setAeolusStops = true; } else if (tag == "swing") { QString swingUnit = e.attribute("unit",""); int unit = 0; if (swingUnit == TDuration(TDuration::DurationType::V_EIGHTH).name()) unit = MScore::division / 2; else if (swingUnit == TDuration(TDuration::DurationType::V_16TH).name()) unit = MScore:: division / 4; else if (swingUnit == TDuration(TDuration::DurationType::V_ZERO).name()) unit = 0; int ratio = e.intAttribute("ratio", 60); setSwing(true); setSwingParameters(unit, ratio); e.readNext(); } else if (!TextBase::readProperties(e)) return false; return true; }
void EditStyle::setValues() { staffUpperBorder->setValue(lstyle.value(StyleIdx::staffUpperBorder).toDouble()); staffLowerBorder->setValue(lstyle.value(StyleIdx::staffLowerBorder).toDouble()); staffDistance->setValue(lstyle.value(StyleIdx::staffDistance).toDouble()); akkoladeDistance->setValue(lstyle.value(StyleIdx::akkoladeDistance).toDouble()); minSystemDistance->setValue(lstyle.value(StyleIdx::minSystemDistance).toDouble()); maxSystemDistance->setValue(lstyle.value(StyleIdx::maxSystemDistance).toDouble()); lyricsDistance->setValue(lstyle.value(StyleIdx::lyricsDistance).toDouble()); lyricsMinBottomDistance->setValue(lstyle.value(StyleIdx::lyricsMinBottomDistance).toDouble()); lyricsLineHeight->setValue(lstyle.value(StyleIdx::lyricsLineHeight).toDouble() * 100.0); systemFrameDistance->setValue(lstyle.value(StyleIdx::systemFrameDistance).toDouble()); frameSystemDistance->setValue(lstyle.value(StyleIdx::frameSystemDistance).toDouble()); minMeasureWidth_2->setValue(lstyle.value(StyleIdx::minMeasureWidth).toDouble()); barWidth->setValue(lstyle.value(StyleIdx::barWidth).toDouble()); endBarWidth->setValue(lstyle.value(StyleIdx::endBarWidth).toDouble()); endBarDistance->setValue(lstyle.value(StyleIdx::endBarDistance).toDouble()); doubleBarWidth->setValue(lstyle.value(StyleIdx::doubleBarWidth).toDouble()); doubleBarDistance->setValue(lstyle.value(StyleIdx::doubleBarDistance).toDouble()); showRepeatBarTips->setChecked(lstyle.value(StyleIdx::repeatBarTips).toBool()); showStartBarlineSingle->setChecked(lstyle.value(StyleIdx::startBarlineSingle).toBool()); showStartBarlineMultiple->setChecked(lstyle.value(StyleIdx::startBarlineMultiple).toBool()); measureSpacing->setValue(lstyle.value(StyleIdx::measureSpacing).toDouble()); minNoteDistance->setValue(lstyle.value(StyleIdx::minNoteDistance).toDouble()); barNoteDistance->setValue(lstyle.value(StyleIdx::barNoteDistance).toDouble()); barAccidentalDistance->setValue(lstyle.value(StyleIdx::barAccidentalDistance).toDouble()); multiMeasureRestMargin->setValue(lstyle.value(StyleIdx::multiMeasureRestMargin).toDouble()); noteBarDistance->setValue(lstyle.value(StyleIdx::noteBarDistance).toDouble()); showMeasureNumber->setChecked(lstyle.value(StyleIdx::showMeasureNumber).toBool()); showFirstMeasureNumber->setChecked(lstyle.value(StyleIdx::showMeasureNumberOne).toBool()); intervalMeasureNumber->setValue(lstyle.value(StyleIdx::measureNumberInterval).toInt()); showIntervalMeasureNumber->setChecked(!lstyle.value(StyleIdx::measureNumberSystem).toBool()); showAllStaffsMeasureNumber->setChecked(lstyle.value(StyleIdx::measureNumberAllStaffs).toBool()); showEverySystemMeasureNumber->setChecked(lstyle.value(StyleIdx::measureNumberSystem).toBool()); clefLeftMargin->setValue(lstyle.value(StyleIdx::clefLeftMargin).toDouble()); keysigLeftMargin->setValue(lstyle.value(StyleIdx::keysigLeftMargin).toDouble()); timesigLeftMargin->setValue(lstyle.value(StyleIdx::timesigLeftMargin).toDouble()); clefKeyRightMargin->setValue(lstyle.value(StyleIdx::clefKeyRightMargin).toDouble()); clefBarlineDistance->setValue(lstyle.value(StyleIdx::clefBarlineDistance).toDouble()); staffLineWidth->setValue(lstyle.value(StyleIdx::staffLineWidth).toDouble()); beamWidth->setValue(lstyle.value(StyleIdx::beamWidth).toDouble()); beamDistance->setValue(lstyle.value(StyleIdx::beamDistance).toDouble() * 100.0); beamMinLen->setValue(lstyle.value(StyleIdx::beamMinLen).toDouble()); beamNoSlope->setChecked(lstyle.value(StyleIdx::beamNoSlope).toBool()); graceNoteSize->setValue(lstyle.value(StyleIdx::graceNoteMag).toDouble() * 100.0); smallStaffSize->setValue(lstyle.value(StyleIdx::smallStaffMag).toDouble() * 100.0); smallNoteSize->setValue(lstyle.value(StyleIdx::smallNoteMag).toDouble() * 100.0); smallClefSize->setValue(lstyle.value(StyleIdx::smallClefMag).toDouble() * 100.0); lastSystemFillThreshold->setValue(lstyle.value(StyleIdx::lastSystemFillLimit).toDouble() * 100.0); hairpinY->setValue(lstyle.value(StyleIdx::hairpinY).toDouble()); hairpinLineWidth->setValue(lstyle.value(StyleIdx::hairpinLineWidth).toDouble()); hairpinHeight->setValue(lstyle.value(StyleIdx::hairpinHeight).toDouble()); hairpinContinueHeight->setValue(lstyle.value(StyleIdx::hairpinContHeight).toDouble()); genClef->setChecked(lstyle.value(StyleIdx::genClef).toBool()); genKeysig->setChecked(lstyle.value(StyleIdx::genKeysig).toBool()); genTimesig->setChecked(lstyle.value(StyleIdx::genTimesig).toBool()); genCourtesyTimesig->setChecked(lstyle.value(StyleIdx::genCourtesyTimesig).toBool()); genCourtesyKeysig->setChecked(lstyle.value(StyleIdx::genCourtesyKeysig).toBool()); genCourtesyClef->setChecked(lstyle.value(StyleIdx::genCourtesyClef).toBool()); swingBox->setValue(lstyle.value(StyleIdx::swingRatio).toInt()); QString unit(lstyle.value(StyleIdx::swingUnit).toString()); if (unit == TDuration(TDuration::DurationType::V_EIGHT).name()) { swingEighth->setChecked(true); swingBox->setEnabled(true); } else if (unit == TDuration(TDuration::DurationType::V_16TH).name()) { swingSixteenth->setChecked(true); swingBox->setEnabled(true); } else if (unit == TDuration(TDuration::DurationType::V_ZERO).name()) { SwingOff->setChecked(true); swingBox->setEnabled(false); } QString s(lstyle.value(StyleIdx::chordDescriptionFile).toString()); chordDescriptionFile->setText(s); chordsXmlFile->setChecked(lstyle.value(StyleIdx::chordsXmlFile).toBool()); QString cstyle(lstyle.value(StyleIdx::chordStyle).toString()); if (cstyle == "std") { chordsStandard->setChecked(true); chordDescriptionGroup->setEnabled(false); } else if (cstyle == "jazz") { chordsJazz->setChecked(true); chordDescriptionGroup->setEnabled(false); } else { chordsCustom->setChecked(true); chordDescriptionGroup->setEnabled(true); } useStandardNoteNames->setChecked(lstyle.value(StyleIdx::useStandardNoteNames).toBool()); useGermanNoteNames->setChecked(lstyle.value(StyleIdx::useGermanNoteNames).toBool()); useSolfeggioNoteNames->setChecked(lstyle.value(StyleIdx::useSolfeggioNoteNames).toBool()); lowerCaseMinorChords->setChecked(lstyle.value(StyleIdx::lowerCaseMinorChords).toBool()); concertPitch->setChecked(lstyle.value(StyleIdx::concertPitch).toBool()); multiMeasureRests->setChecked(lstyle.value(StyleIdx::createMultiMeasureRests).toBool()); minEmptyMeasures->setValue(lstyle.value(StyleIdx::minEmptyMeasures).toInt()); minMeasureWidth->setValue(lstyle.value(StyleIdx::minMMRestWidth).toDouble()); hideEmptyStaves->setChecked(lstyle.value(StyleIdx::hideEmptyStaves).toBool()); dontHideStavesInFirstSystem->setChecked(lstyle.value(StyleIdx::dontHideStavesInFirstSystem).toBool()); dontHideStavesInFirstSystem->setEnabled(hideEmptyStaves->isChecked()); hideInstrumentNameIfOneInstrument->setChecked(lstyle.value(StyleIdx::hideInstrumentNameIfOneInstrument).toBool()); accidentalNoteDistance->setValue(lstyle.value(StyleIdx::accidentalNoteDistance).toDouble()); accidentalDistance->setValue(lstyle.value(StyleIdx::accidentalDistance).toDouble()); dotMag->setValue(lstyle.value(StyleIdx::dotMag).toDouble() * 100.0); noteDotDistance->setValue(lstyle.value(StyleIdx::dotNoteDistance).toDouble()); dotDotDistance->setValue(lstyle.value(StyleIdx::dotDotDistance).toDouble()); stemWidth->setValue(lstyle.value(StyleIdx::stemWidth).toDouble()); ledgerLineWidth->setValue(lstyle.value(StyleIdx::ledgerLineWidth).toDouble()); ledgerLineLength->setValue(lstyle.value(StyleIdx::ledgerLineLength).toDouble()); bracketWidth->setValue(lstyle.value(StyleIdx::bracketWidth).toDouble()); bracketDistance->setValue(lstyle.value(StyleIdx::bracketDistance).toDouble()); akkoladeWidth->setValue(lstyle.value(StyleIdx::akkoladeWidth).toDouble()); akkoladeBarDistance->setValue(lstyle.value(StyleIdx::akkoladeBarDistance).toDouble()); propertyDistanceHead->setValue(lstyle.value(StyleIdx::propertyDistanceHead).toDouble()); propertyDistanceStem->setValue(lstyle.value(StyleIdx::propertyDistanceStem).toDouble()); propertyDistance->setValue(lstyle.value(StyleIdx::propertyDistance).toDouble()); articulationMag->setValue(lstyle.value(StyleIdx::articulationMag).toDouble() * 100.0); shortenStem->setChecked(lstyle.value(StyleIdx::shortenStem).toBool()); shortStemProgression->setValue(lstyle.value(StyleIdx::shortStemProgression).toDouble()); shortestStem->setValue(lstyle.value(StyleIdx::shortestStem).toDouble()); arpeggioNoteDistance->setValue(lstyle.value(StyleIdx::ArpeggioNoteDistance).toDouble()); arpeggioLineWidth->setValue(lstyle.value(StyleIdx::ArpeggioLineWidth).toDouble()); arpeggioHookLen->setValue(lstyle.value(StyleIdx::ArpeggioHookLen).toDouble()); // figured bass for(int i = 0; i < comboFBFont->count(); i++) if(comboFBFont->itemText(i) == lstyle.value(StyleIdx::figuredBassFontFamily).toString()) { comboFBFont->setCurrentIndex(i); break; } doubleSpinFBSize->setValue(lstyle.value(StyleIdx::figuredBassFontSize).toDouble()); doubleSpinFBVertPos->setValue(lstyle.value(StyleIdx::figuredBassYOffset).toDouble()); spinFBLineHeight->setValue(lstyle.value(StyleIdx::figuredBassLineHeight).toDouble() * 100.0); radioFBTop->setChecked(lstyle.value(StyleIdx::figuredBassAlignment).toInt() == 0); radioFBBottom->setChecked(lstyle.value(StyleIdx::figuredBassAlignment).toInt() == 1); radioFBModern->setChecked(lstyle.value(StyleIdx::figuredBassStyle).toInt() == 0); radioFBHistoric->setChecked(lstyle.value(StyleIdx::figuredBassStyle).toInt() == 1); for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i) { QComboBox* cb = static_cast<QComboBox*>(articulationTable->cellWidget(i, 1)); if (cb == 0) continue; ArticulationAnchor st = lstyle.articulationAnchor(i); int idx = 0; if (st == ArticulationAnchor::TOP_STAFF) idx = 0; else if (st == ArticulationAnchor::BOTTOM_STAFF) idx = 1; else if (st == ArticulationAnchor::CHORD) idx = 2; cb->setCurrentIndex(idx); } fixNumberMeasures->setValue(lstyle.value(StyleIdx::FixMeasureNumbers).toInt()); fixMeasureWidth->setChecked(lstyle.value(StyleIdx::FixMeasureWidth).toBool()); slurEndLineWidth->setValue(lstyle.value(StyleIdx::SlurEndWidth).toDouble()); slurMidLineWidth->setValue(lstyle.value(StyleIdx::SlurMidWidth).toDouble()); slurDottedLineWidth->setValue(lstyle.value(StyleIdx::SlurDottedWidth).toDouble()); minTieLength->setValue(lstyle.value(StyleIdx::MinTieLength).toDouble()); QString mfont(lstyle.value(StyleIdx::MusicalSymbolFont).toString()); int idx = 0; for (auto i : ScoreFont::scoreFonts()) { if (i.name().toLower() == mfont.toLower()) { musicalSymbolFont->setCurrentIndex(idx); break; } ++idx; } musicalTextFont->clear(); musicalTextFont->addItem("Emmentaler Text", "MScore Text"); musicalTextFont->addItem("Bravura Text", "Bravura Text"); QString tfont(lstyle.value(StyleIdx::MusicalTextFont).toString()); idx = tfont == "Bravura Text" ? 1 : 0; musicalTextFont->setCurrentIndex(idx); showHeader->setChecked(lstyle.value(StyleIdx::showHeader).toBool()); showHeaderFirstPage->setChecked(lstyle.value(StyleIdx::headerFirstPage).toBool()); headerOddEven->setChecked(lstyle.value(StyleIdx::headerOddEven).toBool()); toggleHeaderOddEven(lstyle.value(StyleIdx::headerOddEven).toBool()); setHeaderText(StyleIdx::evenHeaderL, evenHeaderL); setHeaderText(StyleIdx::evenHeaderC, evenHeaderC); setHeaderText(StyleIdx::evenHeaderR, evenHeaderR); setHeaderText(StyleIdx::oddHeaderL, oddHeaderL); setHeaderText(StyleIdx::oddHeaderC, oddHeaderC); setHeaderText(StyleIdx::oddHeaderR, oddHeaderR); showFooter->setChecked(lstyle.value(StyleIdx::showFooter).toBool()); showFooterFirstPage->setChecked(lstyle.value(StyleIdx::footerFirstPage).toBool()); footerOddEven->setChecked(lstyle.value(StyleIdx::footerOddEven).toBool()); toggleFooterOddEven(lstyle.value(StyleIdx::footerOddEven).toBool()); setFooterText(StyleIdx::evenFooterL, evenFooterL); setFooterText(StyleIdx::evenFooterC, evenFooterC); setFooterText(StyleIdx::evenFooterR, evenFooterR); setFooterText(StyleIdx::oddFooterL, oddFooterL); setFooterText(StyleIdx::oddFooterC, oddFooterC); setFooterText(StyleIdx::oddFooterR, oddFooterR); voltaY->setValue(lstyle.value(StyleIdx::voltaY).toDouble()); voltaHook->setValue(lstyle.value(StyleIdx::voltaHook).toDouble()); voltaLineWidth->setValue(lstyle.value(StyleIdx::voltaLineWidth).toDouble()); voltaLineStyle->setCurrentIndex(lstyle.value(StyleIdx::voltaLineStyle).toInt()-1); ottavaY->setValue(lstyle.value(StyleIdx::ottavaY).toDouble()); ottavaHook->setValue(lstyle.value(StyleIdx::ottavaHook).toDouble()); ottavaLineWidth->setValue(lstyle.value(StyleIdx::ottavaLineWidth).toDouble()); ottavaLineStyle->setCurrentIndex(lstyle.value(StyleIdx::ottavaLineStyle).toInt()-1); ottavaNumbersOnly->setChecked(lstyle.value(StyleIdx::ottavaNumbersOnly).toBool()); trillY->setValue(lstyle.value(StyleIdx::trillY).toDouble()); harmonyY->setValue(lstyle.value(StyleIdx::harmonyY).toDouble()); harmonyFretDist->setValue(lstyle.value(StyleIdx::harmonyFretDist).toDouble()); minHarmonyDistance->setValue(lstyle.value(StyleIdx::minHarmonyDistance).toDouble()); maxHarmonyBarDistance->setValue(lstyle.value(StyleIdx::maxHarmonyBarDistance).toDouble()); capoPosition->setValue(lstyle.value(StyleIdx::capoPosition).toInt()); fretNumMag->setValue(lstyle.value(StyleIdx::fretNumMag).toDouble()*100.0); radioFretNumLeft->setChecked(lstyle.value(StyleIdx::fretNumPos).toInt() == 0); radioFretNumRight->setChecked(lstyle.value(StyleIdx::fretNumPos).toInt() == 1); fretY->setValue(lstyle.value(StyleIdx::fretY).toDouble()); pedalY->setValue(lstyle.value(StyleIdx::pedalY).toDouble()); pedalLineWidth->setValue(lstyle.value(StyleIdx::pedalLineWidth).toDouble()); pedalLineStyle->setCurrentIndex(lstyle.value(StyleIdx::pedalLineStyle).toInt()-1); clefTab1->setChecked(lstyle.value(StyleIdx::tabClef).toInt() == int(ClefType::TAB)); clefTab2->setChecked(lstyle.value(StyleIdx::tabClef).toInt() == int(ClefType::TAB2)); crossMeasureValues->setChecked(lstyle.value(StyleIdx::crossMeasureValues).toBool()); radioKeySigNatNone->setChecked (lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::NONE)); radioKeySigNatBefore->setChecked(lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::BEFORE)); radioKeySigNatAfter->setChecked (lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::AFTER)); tupletMaxSlope->setValue(lstyle.value(StyleIdx::tupletMaxSlope).toDouble()); tupletOutOfStaff->setChecked(lstyle.value(StyleIdx::tupletOufOfStaff).toBool()); tupletVHeadDistance->setValue(lstyle.value(StyleIdx::tupletVHeadDistance).toDouble()); tupletVStemDistance->setValue(lstyle.value(StyleIdx::tupletVStemDistance).toDouble()); tupletStemLeftDistance->setValue(lstyle.value(StyleIdx::tupletStemLeftDistance).toDouble()); tupletStemRightDistance->setValue(lstyle.value(StyleIdx::tupletStemRightDistance).toDouble()); tupletNoteLeftDistance->setValue(lstyle.value(StyleIdx::tupletNoteLeftDistance).toDouble()); tupletNoteRightDistance->setValue(lstyle.value(StyleIdx::tupletNoteRightDistance).toDouble()); }