Ejemplo n.º 1
0
bool Fermata::setProperty(Pid propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case Pid::PLACEMENT: {
                  Placement p = Placement(v.toInt());
                  if (p != placement()) {
                        QString s = Sym::id2name(_symId);
                        bool up = placeAbove();
                        if (s.endsWith(up ? "Above" : "Below")) {
                              QString s2 = s.left(s.size() - 5) + (up ? "Below" : "Above");
                              _symId = Sym::name2id(s2);
                              }
                        setPlacement(p);
                        }
                  }
                  break;
            case Pid::PLAY:
                  setPlay(v.toBool());
                  break;
            case Pid::TIME_STRETCH:
                  setTimeStretch(v.toDouble());
                  score()->fixTicks();
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 2
0
bool Image::setProperty(Pid propertyId, const QVariant& v)
      {
      bool rv = true;
      score()->addRefresh(canvasBoundingRect());
      switch(propertyId) {
            case Pid::AUTOSCALE:
                  setAutoScale(v.toBool());
                  break;
            case Pid::SIZE:
                  setSize(v.toSizeF());
                  break;
            case Pid::LOCK_ASPECT_RATIO:
                  setLockAspectRatio(v.toBool());
                  break;
            case Pid::SIZE_IS_SPATIUM:
                  {
                  QSizeF s = size2pixel(_size);
                  setSizeIsSpatium(v.toBool());
                  _size = pixel2size(s);
                  }
                  break;
            default:
                  rv = Element::setProperty(propertyId, v);
                  break;
            }
      setGenerated(false);
      _dirty = true;
      triggerLayout();
      return rv;
      }
Ejemplo n.º 3
0
void QMainWindow::setRightJustification( bool enable )
{
    if ( enable == d->justify )
	return;
    d->justify = enable;
    triggerLayout();
}
Ejemplo n.º 4
0
void MeasureBase::add(Element* e)
      {
      e->setParent(this);
      if (e->isLayoutBreak()) {
            LayoutBreak* b = toLayoutBreak(e);
            switch (b->layoutBreakType()) {
                  case LayoutBreak::PAGE:
                        setPageBreak(true);
                        setLineBreak(false);
                        setNoBreak(false);
                        break;
                  case LayoutBreak::LINE:
                        setPageBreak(false);
                        setLineBreak(true);
                        setSectionBreak(false);
                        setNoBreak(false);
                        break;
                  case LayoutBreak::SECTION:
                        setLineBreak(false);
                        setSectionBreak(true);
                        setNoBreak(false);
      //does not work with repeats: score()->tempomap()->setPause(endTick(), b->pause());
                        score()->setLayoutAll();
                        break;
                  case LayoutBreak::NOBREAK:
                        setPageBreak(false);
                        setLineBreak(false);
                        setSectionBreak(false);
                        setNoBreak(true);
                        break;
                  }
            }
      triggerLayout();
      _el.push_back(e);
      }
Ejemplo n.º 5
0
bool Ottava::setProperty(Pid propertyId, const QVariant& val)
      {
      switch (propertyId) {
            case Pid::OTTAVA_TYPE:
                  setOttavaType(OttavaType(val.toInt()));
                  break;

            case Pid::NUMBERS_ONLY:
                  _numbersOnly = val.toBool();
                  break;

            case Pid::SPANNER_TICKS:
                  setTicks(val.value<Fraction>());
                  staff()->updateOttava();
                  break;

            case Pid::SPANNER_TICK:
                  setTick(val.value<Fraction>());
                  staff()->updateOttava();
                  break;

            default:
                  if (!TextLineBase::setProperty(propertyId, val))
                        return false;
                  break;
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 6
0
bool Articulation::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case P_ID::DIRECTION:
                  setDirection(v.value<Direction>());
                  break;
            case P_ID::ARTICULATION_ANCHOR:
                  setAnchor(ArticulationAnchor(v.toInt()));
                  break;
            case P_ID::PLAY:
                  setPlayArticulation(v.toBool());
                  break;
            case P_ID::ORNAMENT_STYLE:
                  setOrnamentStyle(MScore::OrnamentStyle(v.toInt()));
                  break;
            case P_ID::TIME_STRETCH:
                  setTimeStretch(v.toDouble());
                  score()->fixTicks();
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 7
0
bool Volta::setProperty(P_ID propertyId, const QVariant& val)
      {
      switch (propertyId) {
            case P_ID::VOLTA_TYPE:
                  setVoltaType(Type(val.toInt()));
                  break;
            case P_ID::VOLTA_ENDING:
                  setEndings(val.value<QList<int>>());
                  break;
            case P_ID::LINE_WIDTH:
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  setLineWidth(val.value<Spatium>());
                  break;
            case P_ID::LINE_STYLE:
                  lineStyleStyle = PropertyStyle::UNSTYLED;
                  setLineStyle(Qt::PenStyle(val.toInt()));
                  break;
            default:
                  if (!TextLineBase::setProperty(propertyId, val))
                        return false;
                  break;
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 8
0
bool Hairpin::setProperty(P_ID id, const QVariant& v)
      {
      switch (id) {
            case P_ID::HAIRPIN_CIRCLEDTIP:
                _hairpinCircledTip = v.toBool();
                break;
            case P_ID::HAIRPIN_TYPE:
                  setHairpinType(Type(v.toInt()));
                  setGenerated(false);
                  break;
            case P_ID::VELO_CHANGE:
                  _veloChange = v.toInt();
                  break;
            case P_ID::DYNAMIC_RANGE:
                  _dynRange = Dynamic::Range(v.toInt());
                  break;
            case P_ID::LINE_WIDTH:
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  TextLine::setProperty(id, v);
                  break;
            case P_ID::HAIRPIN_HEIGHT:
                  hairpinHeightStyle = PropertyStyle::UNSTYLED;
                  _hairpinHeight = v.value<Spatium>();
                  break;
            case P_ID::HAIRPIN_CONT_HEIGHT:
                  hairpinContHeightStyle = PropertyStyle::UNSTYLED;
                  _hairpinContHeight = v.value<Spatium>();
                  break;
            default:
                  return TextLine::setProperty(id, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 9
0
void QMainWindow::setCentralWidget( QWidget * w )
{
    if ( d->mc )
	d->mc->removeEventFilter( this );
    d->mc = w;
    d->mc->installEventFilter( this );
    triggerLayout();
}
Ejemplo n.º 10
0
bool Fingering::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            default:
                  return Text::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 11
0
void TextBase::endEdit(EditData& ed)
      {
      TextEditData* ted = static_cast<TextEditData*>(ed.getData(this));
      score()->undoStack()->remove(ted->startUndoIdx);           // remove all undo/redo records

      // replace all undo/redo records collected during text editing with
      // one property change

      QString actualText = xmlText();
      if (ted->oldXmlText.isEmpty()) {
            UndoStack* us = score()->undoStack();
            UndoCommand* ucmd = us->last();
            if (ucmd) {
                  const QList<UndoCommand*>& cl = ucmd->commands();
                  const UndoCommand* cmd = cl.back();
                  if (strncmp(cmd->name(), "Add:", 4) == 0) {
                        const AddElement* ae = static_cast<const AddElement*>(cmd);
                        if (ae->getElement() == this) {
                              if (actualText.isEmpty()) {
                                    // we just created this empty text, rollback that operation
                                    us->rollback();
                                    score()->update();
                                    ed.element = 0;
                                    }
                              else {
                                    setXmlText(ted->oldXmlText);  // reset text to value before editing
                                    us->reopen();
                                    // combine undo records of text creation with text editing
                                    undoChangeProperty(Pid::TEXT, actualText);
                                    layout1();
                                    score()->endCmd();
                                    }
                              return;
                              }
                        }
                  }
            }
      if (actualText.isEmpty()) {
            qDebug("actual text is empty");
            score()->startCmd();
            score()->undoRemoveElement(this);
            ed.element = 0;
            score()->endCmd();
            return;
            }
      setXmlText(ted->oldXmlText);                    // reset text to value before editing
      score()->startCmd();
      undoChangeProperty(Pid::TEXT, actualText);      // change property to set text to actual value again
                                                      // this also changes text of linked elements
      layout1();
      triggerLayout();                                // force relayout even if text did not change
      score()->endCmd();

      static const qreal w = 2.0;
      score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
      }
Ejemplo n.º 12
0
void QMainWindow::setMenuBar( QMenuBar * newMenuBar )
{
    if ( !newMenuBar )
	return;
    if ( d->mb )
	delete d->mb;
    d->mb = newMenuBar;
    d->mb->installEventFilter( this );
    triggerLayout();
}
Ejemplo n.º 13
0
void HairpinSegment::editDrag(const EditData& ed)
      {
      if (ed.curGrip == Grip::APERTURE) {
            qreal newHeight = hairpin()->hairpinHeight().val() + ed.delta.y()/spatium()/.5;
            if (newHeight < 0.5)
                  newHeight = 0.5;
            hairpin()->setHairpinHeight(Spatium(newHeight));
            triggerLayout();
            }
      LineSegment::editDrag(ed);
      }
Ejemplo n.º 14
0
void TextBase::editInsertText(TextCursor* cursor, const QString& s)
      {
      Q_ASSERT(!layoutInvalid);
      textInvalid = true;

      cursor->curLine().insert(cursor, s);
      cursor->setColumn(cursor->column() + s.size());
      cursor->clearSelection();

      triggerLayout();
      }
Ejemplo n.º 15
0
bool Clef::setProperty(Pid propertyId, const QVariant& v)
      {
      switch(propertyId) {
            case Pid::SHOW_COURTESY: _showCourtesy = v.toBool(); break;
            case Pid::SMALL:         setSmall(v.toBool()); break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 16
0
bool Stem::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case P_ID::USER_LEN:
                  setUserLen(v.toDouble());
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 17
0
bool QMainWindow::eventFilter( QObject* o, QEvent *e )
{
    if ( e->type() == Event_Show || e->type() == Event_Hide ) {
	triggerLayout();
    } else if ( ( e->type() == Event_MouseButtonPress ||
		  e->type() == Event_MouseMove ||
		  e->type() == Event_MouseButtonRelease ) &&
		0 && // 1.4x
		o && ( d->moving || o->inherits( "QToolBar" ) ) ) {
	moveToolBar( d->moving ? d->moving : (QToolBar *)o, (QMouseEvent *)e );
	return TRUE;
    }
    return QWidget::eventFilter( o, e );
}
Ejemplo n.º 18
0
void QMainWindow::setStatusBar( QStatusBar * newStatusBar )
{
    if ( !newStatusBar || newStatusBar == d->sb )
	return;
    if ( d->sb )
	delete d->sb;
    d->sb = newStatusBar;
    connect( toolTipGroup(), SIGNAL(showTip(const char *)),
	     d->sb, SLOT(message(const char *)) );
    connect( toolTipGroup(), SIGNAL(removeTip()),
	     d->sb, SLOT(clear()) );
    d->sb->installEventFilter( this );
    triggerLayout();
}
Ejemplo n.º 19
0
void QMainWindow::setToolTipGroup( QToolTipGroup * newToolTipGroup )
{
    if ( !newToolTipGroup || newToolTipGroup == d->ttg )
	return;
    if ( d->ttg )
	delete d->ttg;
    d->ttg = newToolTipGroup;

    connect( toolTipGroup(), SIGNAL(showTip(const char *)),
	     statusBar(), SLOT(message(const char *)) );
    connect( toolTipGroup(), SIGNAL(removeTip()),
	     statusBar(), SLOT(clear()) );
    triggerLayout();
}
Ejemplo n.º 20
0
bool Volta::setProperty(P_ID propertyId, const QVariant& val)
      {
      switch (propertyId) {
            case P_ID::VOLTA_ENDING:
                  setEndings(val.value<QList<int>>());
                  break;
            default:
                  if (!TextLineBase::setProperty(propertyId, val))
                        return false;
                  break;
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 21
0
bool QMainWindow::event( QEvent * e )
{
    if ( e->type() == Event_ChildRemoved ) {
	QChildEvent * c = (QChildEvent *) e;
	if ( c->child() == 0 ||
	     c->child()->testWFlags( WType_TopLevel ) ) {
	    // nothing
	} else if ( c->child() == d->sb ) {
	    d->sb = 0;
	    triggerLayout();
	} else if ( c->child() == d->mb ) {
	    d->mb = 0;
	    triggerLayout();
	} else if ( c->child() == d->mc ) {
	    d->mc = 0;
	    triggerLayout();
	} else {
	    removeToolBar( (QToolBar *)(c->child()) );
	    triggerLayout();
	}
    }
    return QWidget::event( e );
}
Ejemplo n.º 22
0
bool Breath::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch(propertyId) {
            case P_ID::PAUSE:
                  setPause(v.toDouble());
                  break;
            default:
                  if (!Element::setProperty(propertyId, v))
                        return false;
                  break;
            }
      triggerLayout();
      setGenerated(false);
      return true;
      }
Ejemplo n.º 23
0
void TextBase::editInsertText(TextCursor* cursor, const QString& s)
      {
      Q_ASSERT(!layoutInvalid);
      textInvalid = true;

      int col = 0;
      for (const QChar& c : s) {
            if (!c.isHighSurrogate())
                  ++col;
            }
      cursor->curLine().insert(cursor, s);
      cursor->setColumn(cursor->column() + col);
      cursor->clearSelection();

      triggerLayout();
      }
Ejemplo n.º 24
0
bool TempoText::setProperty(Pid propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case Pid::TEMPO:
                  setTempo(v.toDouble());
                  score()->setTempo(segment(), _tempo);
                  score()->fixTicks();
                  break;
            case Pid::TEMPO_FOLLOW_TEXT:
                  _followText = v.toBool();
                  break;
            default:
                  if (!TextBase::setProperty(propertyId, v))
                        return false;
                  break;
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 25
0
bool Ambitus::setProperty(Pid propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case Pid::HEAD_GROUP:
                  setNoteHeadGroup( NoteHead::Group(v.toInt()) );
                  break;
            case Pid::HEAD_TYPE:
                  setNoteHeadType( NoteHead::Type(v.toInt()) );
                  break;
            case Pid::MIRROR_HEAD:
                  setDirection(MScore::DirectionH(v.toInt()) );
                  break;
            case Pid::GHOST:                 // recycled property = _hasLine
                  setHasLine(v.toBool());
                  break;
            case Pid::LINE_WIDTH:
                  setLineWidth(v.value<Spatium>());
                  break;
            case Pid::TPC1:
                  setTopTpc(v.toInt());
                  break;
            case Pid::FBPARENTHESIS1:        // recycled property = _bottomTpc
                  setBottomTpc(v.toInt());
                  break;
            case Pid::PITCH:
                  setTopPitch(v.toInt());
                  break;
            case Pid::FBPARENTHESIS2:        // recycled property = _bottomPitch
                  setBottomPitch(v.toInt());
                  break;
            case Pid::FBPARENTHESIS3:        // recycled property = octave of _topPitch
                  setTopPitch(topPitch() % 12 + v.toInt() * 12);
                  break;
            case Pid::FBPARENTHESIS4:        // recycled property = octave of _bottomPitch
                  setBottomPitch(bottomPitch() % 12 + v.toInt() * 12);
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 26
0
void QMainWindow::removeToolBar( QToolBar * toolBar )
{
    if ( !toolBar )
	return;
    QMainWindowPrivate::ToolBar * ct;
    ct = takeToolBarFromDock( toolBar, d->top );
    if ( !ct )
	ct = takeToolBarFromDock( toolBar, d->left );
    if ( !ct )
	ct = takeToolBarFromDock( toolBar, d->right );
    if ( !ct )
	ct = takeToolBarFromDock( toolBar, d->bottom );
    if ( !ct )
	ct = takeToolBarFromDock( toolBar, d->tornOff );
    if ( !ct )
	ct = takeToolBarFromDock( toolBar, d->unmanaged );
    if ( ct ) {
	delete ct;
	triggerLayout();
    }
}
Ejemplo n.º 27
0
void Hairpin::resetProperty(P_ID id)
      {
      switch (id) {
            case P_ID::LINE_WIDTH:
                  setProperty(id, propertyDefault(id));
                  lineWidthStyle = PropertyStyle::STYLED;
                  break;

            case P_ID::HAIRPIN_HEIGHT:
                  setProperty(id, propertyDefault(id));
                  hairpinHeightStyle = PropertyStyle::STYLED;
                  break;

            case P_ID::HAIRPIN_CONT_HEIGHT:
                  setLineWidth(score()->styleS(StyleIdx::hairpinLineWidth));
                  hairpinContHeightStyle = PropertyStyle::STYLED;
                  break;

            default:
                  return TextLine::resetProperty(id);
            }
      triggerLayout();
      }
Ejemplo n.º 28
0
void QMainWindow::addToolBar( QToolBar * toolBar, const char * label,
			      ToolBarDock edge, bool nl )
{
    if ( !toolBar )
	return;

    setDockEnabled( edge, TRUE );

    QMainWindowPrivate::ToolBarDock * dl = 0;
    if ( edge == Top ) {
	dl = d->top;
	toolBar->setOrientation( QToolBar::Horizontal );
	toolBar->installEventFilter( this );
    } else if ( edge == Left ) {
	dl = d->left;
	toolBar->setOrientation( QToolBar::Vertical );
	toolBar->installEventFilter( this );
    } else if ( edge == Bottom ) {
	dl = d->bottom;
	toolBar->setOrientation( QToolBar::Horizontal );
	toolBar->installEventFilter( this );
    } else if ( edge == Right ) {
	dl = d->right;
	toolBar->setOrientation( QToolBar::Vertical );
	toolBar->installEventFilter( this );
    } else if ( edge == TornOff ) {
	dl = d->tornOff;
    } else if ( edge == Unmanaged ) {
	dl = d->unmanaged;
    }

    if ( !dl )
	return;

    dl->append( new QMainWindowPrivate::ToolBar( toolBar, label, nl ) );
    triggerLayout();
}
Ejemplo n.º 29
0
bool Bend::setProperty(Pid id, const QVariant& v)
      {
      switch (id) {
            case Pid::FONT_FACE:
                  _fontFace = v.toString();
                  break;
            case Pid::FONT_SIZE:
                  _fontSize = v.toReal();
                  break;
            case Pid::FONT_STYLE:
                  _fontStyle = FontStyle(v.toInt());
                  break;
            case Pid::PLAY:
                 setPlayBend(v.toBool());
                 break;
            case Pid::LINE_WIDTH:
                  _lineWidth = v.toReal();
                  break;
            default:
                  return Element::setProperty(id, v);
            }
      triggerLayout();
      return true;
      }
Ejemplo n.º 30
0
bool Jump::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case P_ID::JUMP_TO:
                  setJumpTo(v.toString());
                  break;
            case P_ID::PLAY_UNTIL:
                  setPlayUntil(v.toString());
                  break;
            case P_ID::CONTINUE_AT:
                  setContinueAt(v.toString());
                  break;
            case P_ID::PLAY_REPEATS:
                  setPlayRepeats(v.toInt());
                  break;
            default:
                  if (!Text::setProperty(propertyId, v))
                        return false;
                  break;
            }
      triggerLayout();
      score()->setPlaylistDirty();
      return true;
      }