Exemplo n.º 1
0
void CGLabel::setPropsFromPalette(CGPalette *palette)
{
    CGFrame::setPropsFromPalette(palette);
    if (palette) {
        setFrameWidth(0);
        setBackgroundColor(CGColor::ccTransparent);

    }
}
Exemplo n.º 2
0
void CGFrame::setPropsFromPalette(CGPalette *palette)
{
    CGWidget::setPropsFromPalette(palette);
    if (palette) {
        setFrameWidth(palette->size(CGPalette::srFrameWidth));
        setFrameColor(palette->color(CGPalette::crFrame));
        setFocusedFrameWidth(palette->size(CGPalette::srFocusedFrameWidth));
        setFocusedFrameColor(palette->color(CGPalette::crFocusedFrame));
    }
}
Exemplo n.º 3
0
CGLabel::CGLabel(CGWidget *parent):
    CGFrame(parent), CGFontPropsWithAlignment(this)
{
    m_verticalAlignment=cgalLeft;
    m_horizontalAlignment=cgalTop;
    m_textOffset=1;
    setFrameWidth(0);
    setFrameColor(CGColor::ccTransparent);
    setBackgroundColor(CGColor::ccTransparent);
    setTextColor(CGColor::ccBlack);
    setPropsFromDefaultPalette();
}
Exemplo n.º 4
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;
      }
Exemplo n.º 5
0
CGLabel::CGLabel(int x, int y, int width, int height, CGWidget *parent):
    CGFrame(x,y,width,height,parent), CGFontPropsWithAlignment(this)
{
    m_verticalAlignment=cgalLeft;
    m_horizontalAlignment=cgalTop;
    m_lineSpacing=1.2;
    m_bold=false;
    m_italic=false;
    m_fontFace="sans";
    m_fontSize=10;
    m_textOffset=1;
    setFrameWidth(0);
    setFrameColor(CGColor::ccTransparent);
    setBackgroundColor(CGColor::ccTransparent);
    setTextColor(CGColor::ccBlack);
    setPropsFromDefaultPalette();
}
Exemplo n.º 6
0
    unsigned  
    VLC::setup_video(char * chroma, unsigned *width, unsigned *height, unsigned *pitches, unsigned *lines) {
        AC_DEBUG << "VLC requesting " << chroma << " " << *width << "x" << *height << " for " << _mediaURL;

        // TODO: we could use our YUV shader here
        AC_INFO << "Can't render " << chroma << ", asking libvlc to convert to RGB";
        memcpy(chroma, "RV24", 4);  
        _rasterEncoding = BGR;
        
        _myFrameWidth = *width;
        _myFrameHeight = *height;
        (*pitches) = getBytesRequired(_myFrameWidth, _rasterEncoding);
        (*lines) = _myFrameHeight;
        
        setPixelFormat(_rasterEncoding);
        setFrameHeight(_myFrameHeight);
        setFrameWidth(_myFrameWidth);

        return 1; // one color plane
    }
Exemplo n.º 7
0
    void
    VLC::readFrame(dom::ResizeableRasterPtr theTargetRaster) {
        ScopeLocker myFrameLock(_myFrameLock, true);
        if (_curBuffer == NULL) {
            return;
        }
		if (getFrameWidth() != _myFrameWidth) setFrameWidth(_myFrameWidth);
		if (getFrameHeight() != _myFrameHeight) setFrameHeight(_myFrameHeight);
        theTargetRaster->resize(getFrameWidth(), getFrameHeight());
        std::copy(_curBuffer->begin(), _curBuffer->end(), theTargetRaster->pixels().begin());
        
        libvlc_time_t curTimeCode = libvlc_media_player_get_time(_mediaPlayer);
        AC_TRACE << "-- timestamp from vlc: " << curTimeCode;
        setTimeCode(as_string(curTimeCode));

        // delete the current buffer, marking that we already copied it to the texture
        AC_TRACE << "freeing " << _curBuffer->size() << " bytes after copying to texture.";
        delete _curBuffer;
        _curBuffer = NULL;
    }
Exemplo n.º 8
0
bool Text::readProperties(const QDomElement& e)
      {
      const QString& tag(e.tagName());
      const QString& val(e.text());

      if (tag == "style") {
            int st;
            bool ok;
            int i = val.toInt(&ok);
            if (ok) {
                  // obsolete old text styles
                  switch (i) {
                        case 1:  i = TEXT_STYLE_UNSTYLED;  break;
                        case 2:  i = TEXT_STYLE_TITLE;     break;
                        case 3:  i = TEXT_STYLE_SUBTITLE;  break;
                        case 4:  i = TEXT_STYLE_COMPOSER;  break;
                        case 5:  i = TEXT_STYLE_POET;      break;
                        case 6:  i = TEXT_STYLE_LYRIC1;    break;
                        case 7:  i = TEXT_STYLE_LYRIC2;    break;
                        case 8:  i = TEXT_STYLE_FINGERING; break;
                        case 9:  i = TEXT_STYLE_INSTRUMENT_LONG;    break;
                        case 10: i = TEXT_STYLE_INSTRUMENT_SHORT;   break;
                        case 11: i = TEXT_STYLE_INSTRUMENT_EXCERPT; break;

                        case 12: i = TEXT_STYLE_DYNAMICS;  break;
                        case 13: i = TEXT_STYLE_TECHNIK;   break;
                        case 14: i = TEXT_STYLE_TEMPO;     break;
                        case 15: i = TEXT_STYLE_METRONOME; break;
                        case 16: i = TEXT_STYLE_FOOTER;    break;  // TEXT_STYLE_COPYRIGHT
                        case 17: i = TEXT_STYLE_MEASURE_NUMBER; break;
                        case 18: i = TEXT_STYLE_FOOTER; break;    // TEXT_STYLE_PAGE_NUMBER_ODD
                        case 19: i = TEXT_STYLE_FOOTER; break;    // TEXT_STYLE_PAGE_NUMBER_EVEN
                        case 20: i = TEXT_STYLE_TRANSLATOR; break;
                        case 21: i = TEXT_STYLE_TUPLET;     break;

                        case 22: i = TEXT_STYLE_SYSTEM;         break;
                        case 23: i = TEXT_STYLE_STAFF;          break;
                        case 24: i = TEXT_STYLE_HARMONY;        break;
                        case 25: i = TEXT_STYLE_REHEARSAL_MARK; break;
                        case 26: i = TEXT_STYLE_REPEAT;         break;
                        case 27: i = TEXT_STYLE_VOLTA;          break;
                        case 28: i = TEXT_STYLE_FRAME;          break;
                        case 29: i = TEXT_STYLE_TEXTLINE;       break;
                        case 30: i = TEXT_STYLE_GLISSANDO;      break;
                        case 31: i = TEXT_STYLE_STRING_NUMBER;  break;

                        case 32: i = TEXT_STYLE_OTTAVA;  break;
                        case 33: i = TEXT_STYLE_BENCH;   break;
                        case 34: i = TEXT_STYLE_HEADER;  break;
                        case 35: i = TEXT_STYLE_FOOTER;  break;
                        case 0:
                        default:
                              qDebug("Text:readProperties: style %d<%s> invalid", i, qPrintable(val));
                              i = TEXT_STYLE_UNSTYLED;
                              break;
                        }
                  st = i;
                  }
            else
                  st = score()->style()->textStyleType(val);

            if (st == TEXT_STYLE_UNSTYLED)
                  setUnstyled();
            else if (st == TEXT_STYLE_UNKNOWN)
                  _styleIndex = st;
            else
                  setTextStyleType(st);
            }
      else if (tag == "styleName")          // obsolete, unstyled text
            ; // _styleName = val;
      else if (tag == "data")                  // obsolete
            _doc->setHtml(val);
      else if (tag == "html") {
            QString s = Xml::htmlToString(e);
            setHtml(s);
            }
      else if (tag == "text")
            setText(val);
      else if (tag == "html-data") {
            QString s = Xml::htmlToString(e.firstChildElement());
            if (score()->mscVersion() <= 114) {
                  s.replace("MScore1", "FreeSerifMscore");
                  s.replace(QChar(0xe10e), QChar(0x266e));    //natural
                  s.replace(QChar(0xe10c), QChar(0x266f));    // sharp
                  s.replace(QChar(0xe10d), QChar(0x266d));    // flat
                  s.replace(QChar(0xe104), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd5e))),    // note2_Sym
                  s.replace(QChar(0xe105), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd5f)));    // note4_Sym
//test                  s.replace(QChar(0xe105), QString("XXX"));
                  s.replace(QChar(0xe106), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd60)));    // note8_Sym
                  s.replace(QChar(0xe107), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd61)));    // note16_Sym
                  s.replace(QChar(0xe108), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd62)));    // note32_Sym
                  s.replace(QChar(0xe109), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd63)));    // note64_Sym
                  s.replace(QChar(0xe10a), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd6d)));    // dot
                  s.replace(QChar(0xe10b), QString("%1%2%3%4").arg(QChar(0xd834)).arg(QChar(0xdd6d)).arg(QChar(0xd834)).arg(QChar(0xdd6d)));    // dotdot
                  s.replace(QChar(0xe167), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd0b)));    // coda
                  s.replace(QChar(0xe168), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd0c)));    // varcoda
                  s.replace(QChar(0xe169), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd0c)));    // segno
                  if (_doc == 0)
                        createDoc();
                  _doc->setHtml(s);
                  if (isSimpleText()) {
                        QString s = _doc->toPlainText();
                        delete _doc;
                        _doc = 0;
                        setText(s);
                        }
                  else {
                        setUnstyled();
                        setHtml(s);
                        }
                  }
            else {
                  setHtml(s);
                  }
            }
      else if (tag == "subtype")          // obsolete
            ;
      else if (tag == "frameWidth") {           // obsolete
            qreal spMM = spatium() / MScore::DPMM;
            setFrameWidth(Spatium(val.toDouble() / spMM));
            }
      else if (tag == "paddingWidth") {          // obsolete
            qreal spMM = spatium() / MScore::DPMM;
            setPaddingWidth(Spatium(val.toDouble() / spMM));
            }
      else if (_textStyle.readProperties(e))
            ;
      else if (!Element::readProperties(e))
            return false;
      return true;
      }