Esempio n. 1
0
void Ottava::read(XmlReader& e)
      {
      qDeleteAll(spannerSegments());
      spannerSegments().clear();
      e.addSpanner(e.intAttribute("id", -1), this);
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "subtype") {
                  QString s = e.readElementText();
                  bool ok;
                  int idx = s.toInt(&ok);
                  if (!ok) {
                        idx = int(Type::OTTAVA_8VA);
                        for (unsigned i = 0; i < sizeof(ottavaDefault)/sizeof(*ottavaDefault); ++i) {
                              if (s == ottavaDefault[i].name) {
                                    idx = i;
                                    break;
                                    }
                              }
                        }
                  else if (score()->mscVersion() <= 114) {
                        //subtype are now in a different order...
                        if (idx == 1)
                              idx = 2;
                        else if (idx == 2)
                              idx = 1;
                        }
                  setOttavaType(Type(idx));
                  }
            else if (tag == "numbersOnly") {
                  _numbersOnly = e.readInt();
                  numbersOnlyStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "lineWidth") {
                  setLineWidth(Spatium(e.readDouble()));
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "lineStyle") {
                  setLineStyle(Qt::PenStyle(e.readInt()));
                  lineStyleStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "beginSymbol") {                      // obsolete
                  beginTextStyle = PropertyStyle::UNSTYLED;
                  QString text(e.readElementText());
                  setBeginText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
                  }
            else if (tag == "continueSymbol") {                   // obsolete
                  continueTextStyle = PropertyStyle::UNSTYLED;
                  QString text(e.readElementText());
                  setContinueText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
                  }
            else if (!TextLine::readProperties(e))
                  e.unknown();
            }
      if (beginText() != propertyDefault(P_ID::BEGIN_TEXT))
            beginTextStyle = PropertyStyle::UNSTYLED;
      if (continueText() != propertyDefault(P_ID::CONTINUE_TEXT))
            continueTextStyle = PropertyStyle::UNSTYLED;
      }
Esempio n. 2
0
QString Volta::text() const
      {
      return beginText();
      }
Esempio n. 3
0
QVariant TextLineBase::getProperty(P_ID id) const
      {
      switch (id) {
            case P_ID::BEGIN_TEXT:
                  return beginText();
            case P_ID::BEGIN_TEXT_ALIGN:
                  return int(beginTextAlign());
            case P_ID::CONTINUE_TEXT_ALIGN:
                  return int(continueTextAlign());
            case P_ID::END_TEXT_ALIGN:
                  return int(endTextAlign());
            case P_ID::BEGIN_TEXT_PLACE:
                  return int(_beginTextPlace);
            case P_ID::BEGIN_HOOK_TYPE:
                  return int(_beginHookType);
            case P_ID::BEGIN_HOOK_HEIGHT:
                  return _beginHookHeight;
            case P_ID::BEGIN_FONT_FACE:
                  return _beginFontFamily;
            case P_ID::BEGIN_FONT_SIZE:
                  return _beginFontSize;
            case P_ID::BEGIN_FONT_BOLD:
                  return _beginFontBold;
            case P_ID::BEGIN_FONT_ITALIC:
                  return _beginFontItalic;
            case P_ID::BEGIN_FONT_UNDERLINE:
                  return _beginFontUnderline;
            case P_ID::BEGIN_TEXT_OFFSET:
                  return _beginTextOffset;
            case P_ID::CONTINUE_TEXT:
                  return continueText();
            case P_ID::CONTINUE_TEXT_PLACE:
                  return int(_continueTextPlace);
            case P_ID::CONTINUE_FONT_FACE:
                  return _continueFontFamily;
            case P_ID::CONTINUE_FONT_SIZE:
                  return _continueFontSize;
            case P_ID::CONTINUE_FONT_BOLD:
                  return _continueFontBold;
            case P_ID::CONTINUE_FONT_ITALIC:
                  return _continueFontItalic;
            case P_ID::CONTINUE_FONT_UNDERLINE:
                  return _continueFontUnderline;
            case P_ID::CONTINUE_TEXT_OFFSET:
                  return _continueTextOffset;
            case P_ID::END_TEXT:
                  return endText();
            case P_ID::END_TEXT_PLACE:
                  return int(_endTextPlace);
            case P_ID::END_HOOK_TYPE:
                  return int(_endHookType);
            case P_ID::END_HOOK_HEIGHT:
                  return _endHookHeight;
            case P_ID::END_FONT_FACE:
                  return _endFontFamily;
            case P_ID::END_FONT_SIZE:
                  return _endFontSize;
            case P_ID::END_FONT_BOLD:
                  return _endFontBold;
            case P_ID::END_FONT_ITALIC:
                  return _endFontItalic;
            case P_ID::END_FONT_UNDERLINE:
                  return _endFontUnderline;
            case P_ID::END_TEXT_OFFSET:
                  return _endTextOffset;
            case P_ID::LINE_VISIBLE:
                  return lineVisible();
            default:
                  return SLine::getProperty(id);
            }
      }