void Marker::read(XmlReader* r) { MarkerType mt; while (r->readElement()) { QString s; if (r->readString("label", &s)) { setLabel(s); mt = markerType(s); } else if (!Text::readProperties(r)) r->unknown(); } switch(mt) { case MARKER_SEGNO: case MARKER_CODA: case MARKER_VARCODA: case MARKER_CODETTA: setTextStyle(TEXT_STYLE_REPEAT_LEFT); break; case MARKER_FINE: case MARKER_TOCODA: setTextStyle(TEXT_STYLE_REPEAT_RIGHT); break; case MARKER_USER: setTextStyle(TEXT_STYLE_REPEAT); break; } setMarkerType(mt); }
void ZLTextView::ViewStyle::applyControl(const ZLTextControlElement &control) { if (control.isStart()) { const ZLTextStyleDecoration *decoration = ZLTextStyleCollection::instance().decoration(control.textKind()); if (decoration != 0) { setTextStyle(decoration->createDecoratedStyle(myTextStyle)); } } else { if (myTextStyle->isDecorated()) { setTextStyle(((ZLTextDecoratedStyle&)*myTextStyle).base()); } } }
Marker::Marker(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); setSubtype(TEXT_REPEAT); setTextStyle(TEXT_STYLE_REPEAT); }
TempoText::TempoText(Score* s) : Text(s) { _tempo = 2.0; _followText = false; setTextStyle(s->textStyle(TEXT_STYLE_TEMPO)); }
void TextProp::setStyle(TextStyleType st, const TextStyle& ts) { st = TextStyleType(styles->findData(int(st))); // find a combo item with that style idx if (int(st) < 0) // if none found... st = TextStyleType::DEFAULT; // ...=> first combo item styles->setCurrentIndex(int(st)); // set current combo item setTextStyle(ts); }
Dynamic::Dynamic(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); _velocity = -1; setTextStyle(TEXT_STYLE_DYNAMICS); _dynType = DYNAMIC_PART; }
TempoText::TempoText(Score* s) : Text(s) { _tempo = 2.0; // propertyDefault(P_TEMPO).toDouble(); _followText = false; setPlacement(ABOVE); setTextStyle(s->textStyle(TEXT_STYLE_TEMPO)); }
StaffText::StaffText(Score* s) : Text(s) { setSubtype(TEXT_STAFF); setTextStyle(TEXT_STYLE_STAFF); _setAeolusStops = false; clearAeolusStops(); }
void Text::styleChanged() { if (styled()) { if (_styleIndex != TEXT_STYLE_UNKNOWN) setTextStyle(score()->textStyle(_styleIndex)); setText(getText()); // destroy formatting score()->setLayoutAll(true); } }
Lyrics::Lyrics(Score* s) : Text(s) { setTextStyle(TEXT_STYLE_LYRIC1); _no = 0; _ticks = 0; _syllabic = SINGLE; _verseNumber = 0; }
void Text::setTextStyleType(int st) { if (st == _styleIndex) return; _styleIndex = st; if (st != TEXT_STYLE_UNKNOWN) setTextStyle(score()->textStyle(st)); if (_doc && !_doc->isEmpty() && !_editMode) { SimpleText::setText(_doc->toPlainText()); delete _doc; _doc = 0; } }
bool Text::readProperties(XmlReader* r) { MString8 tag = r->tag(); QString val; int i; qreal d; Color color; if (r->readString("style", &val)) { setTextStyle(score()->style().textStyleType(val)); if (textStyle() != TEXT_STYLE_INVALID) _styled = true; } else if (r->readInt("spatiumSizeDependent", &i)) { setSizeIsSpatiumDependent(i); _styled = false; } else if (r->readInt("frame", &i)) { setHasFrame(i); _styled = false; } else if (r->readString("text", &val)) setText(val); else if (tag == "frameWidth") { setFrameWidth(val.toDouble()); setHasFrame(true); _styled = false; } else if (r->readReal("paddingWidth", &d)) { setPaddingWidth(d); _styled = false; } else if (r->readColor("frameColor", &color)) { // setFrameColor(readColor(e)); _styled = false; } else if (r->readInt("frameRound", &i)) { setFrameRound(i); _styled = false; } else if (r->readInt("circle", &i)) { setCircle(i); _styled = false; } else if (_localStyle.readProperties(r)) _styled = false; else if (!Element::readProperties(r)) return false; return true; }
void Jump::read(const QDomElement& de) { for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) { const QString& tag(e.tagName()); if (tag == "jumpTo") _jumpTo = e.text(); else if (tag == "playUntil") _playUntil = e.text(); else if (tag == "continueAt") _continueAt = e.text(); else if (!Text::readProperties(e)) domError(e); } setTextStyle(score()->textStyle(TEXT_STYLE_REPEAT_RIGHT)); }
void Jump::read(XmlReader* r) { while (r->readElement()) { QString s; if (r->readString("jumpTo", &_jumpTo)) ; else if (r->readString("playUntil", &_playUntil)) ; else if (r->readString("continueAt", &_continueAt)) ; else if (!Text::readProperties(r)) r->unknown(); } setTextStyle(TEXT_STYLE_REPEAT_RIGHT); }
Lyrics::Lyrics(const Lyrics& l) : Text(l) { _no = l._no; setTextStyle((_no % 2) ? TEXT_STYLE_LYRIC2 : TEXT_STYLE_LYRIC1); _ticks = l._ticks; _syllabic = l._syllabic; if (l._verseNumber) _verseNumber = new Text(*l._verseNumber); else _verseNumber = 0; QList<Line*> _separator; foreach(Line* l, l._separator) _separator.append(new Line(*l)); }
void Dynamic::read(XmlReader* r) { int i; while (r->readElement()) { if (r->readInt("velocity", &_velocity)) ; else if (r->readInt("dynType", &i)) _dynType = DynamicType(i); else if (!Text::readProperties(r)) r->unknown(); } setSubtype(subtype()); if (score()->mscVersion() < 118) { setTextStyle(TEXT_STYLE_DYNAMICS); setStyled(true); } }
void FiguredBass::layout() { if (!styled()) setTextStyle(TEXT_STYLE_FIGURED_BASS); Lyrics::layout(); qreal lh = lineSpacing() * score()->styleD(ST_figuredBassLineHeight); System* sys = measure()->system(); if (sys == 0) { qDebug("lyrics layout: no system!"); abort(); } const QList<Lyrics*>* ll = &(chordRest()->lyricsList()); int line = ll->indexOf(this); qreal y = lh * line + point(score()->styleS(ST_figuredBassDistance)) + sys->staff(staffIdx())->bbox().height(); QString s = getText(); qreal x = symbols[score()->symIdx()][quartheadSym].width(magS()) * .5; QFontMetricsF fm(style().font(spatium())); for (int i = 0; i < s.size(); ++i) { if (s[i].isNumber()) { if (i) x += -fm.width(s.left(i)); int startIdx = i; for (; i < s.size(); ++i) { if (!s[i].isNumber()) break; } x += -(fm.width(s.mid(startIdx, i - startIdx)) * .5); break; } } x -= spatium() * .25; // DEBUG setPos(x, y); }
void ZLTextView::ViewStyle::applyControl(const ZLTextForcedControlElement &control) { setTextStyle(new ZLTextForcedStyle(myTextStyle, control.entry())); }
Fingering::Fingering(Score* s) : Text(s) { setTextStyle(s->textStyle(TEXT_STYLE_FINGERING)); setFlag(ELEMENT_HAS_TAG, true); }
Marker::Marker(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE | ELEMENT_ON_STAFF); setTextStyle(s->textStyle(TEXT_STYLE_REPEAT)); }
Jump::Jump(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); setTextStyle(s->textStyle(TEXT_STYLE_REPEAT)); }
FiguredBass::FiguredBass(Score* s) : Lyrics(s) { setTextStyle(TEXT_STYLE_FIGURED_BASS); }
void TextProp::styleIndexChanged(int i) { int idx = styles->itemData(i).toInt(); setTextStyle(_score->textStyle(TextStyleType(idx))); }
void TextProp::doResetToTextStyle() { setTextStyle(_score->textStyle(textStyleType())); }
InstrumentChange::InstrumentChange(Score* s) : Text(s) { setTextStyle(s->textStyle(TEXT_STYLE_INSTRUMENT_CHANGE)); }
static void setTextStyles(const ColorSettings& settings) { setTextStyle(nppData._scintillaMainHandle, settings); setTextStyle(nppData._scintillaSecondHandle, settings); }
void ZLTextView::ViewStyle::reset() { setTextStyle(ZLTextStyleCollection::instance().baseStylePtr()); }
ZLTextView::ViewStyle::ViewStyle(shared_ptr<ZLPaintContext> context) : myContext(context) { setTextStyle(ZLTextStyleCollection::instance().baseStylePtr()); myWordHeight = -1; }