示例#1
0
void Spacer::layout0()
      {
      qreal _spatium = spatium();

      path    = QPainterPath();
      qreal w = _spatium;
      qreal b = w * .5;
      qreal h = _gap;

      if (spacerType() == SpacerType::DOWN) {
            path.lineTo(w, 0.0);
            path.moveTo(b, 0.0);
            path.lineTo(b, h);
            path.lineTo(0.0, h-b);
            path.moveTo(b, h);
            path.lineTo(w, h-b);
            }
      else if (spacerType() == SpacerType::UP) {
            path.moveTo(b, 0.0);
            path.lineTo(0.0, b);
            path.moveTo(b, 0.0);
            path.lineTo(w, b);
            path.moveTo(b, 0.0);
            path.lineTo(b, h);
            path.moveTo(0.0, h);
            path.lineTo(w, h);
            }
      qreal lw = _spatium * 0.4;
      QRectF bb(0, 0, w, h);
      bb.adjust(-lw, -lw, lw, lw);
      setbbox(bb);
      }
示例#2
0
void Spacer::updateGrips(Grip* defaultGrip, QVector<QRectF>& grip) const
      {
      *defaultGrip   = Grip::START;
      qreal _spatium = spatium();
      QPointF p;
      if (spacerType() == SpacerType::DOWN)
            p = QPointF(_spatium * .5, _gap);
      else if (spacerType() == SpacerType::UP)
            p = QPointF(_spatium * .5, 0.0);
      grip[0].translate(pagePos() + p);
      }
示例#3
0
void Spacer::editDrag(const EditData& ed)
      {
      qreal s = ed.delta.y();
      if (spacerType() == SpacerType::DOWN)
            _gap += s;
      else if (spacerType() == SpacerType::UP)
            _gap -= s;
      if (_gap < spatium() * 2.0)
            _gap = spatium() * 2;
      layout0();
      score()->setLayoutAll(true);
      }
示例#4
0
void Spacer::updateGrips(int* grips, int* defaultGrip, QRectF* grip) const
      {
      *grips         = 1;
      *defaultGrip   = 0;
      qreal _spatium = spatium();
      QPointF p;
      if (spacerType() == SPACER_DOWN)
            p = QPointF(_spatium * .5, _gap);
      else if (spacerType() == SPACER_UP)
            p = QPointF(_spatium * .5, 0.0);
      grip[0].translate(pagePos() + p);
      }
示例#5
0
void Spacer::updateGrips(EditData& ed) const
      {
      qreal _spatium = spatium();
      QPointF p;
      switch (spacerType()) {
            case SpacerType::DOWN:
            case SpacerType::FIXED:
                  p = QPointF(_spatium * .5, _gap);
                  break;
            case SpacerType::UP:
                  p = QPointF(_spatium * .5, 0.0);
                  break;
            }
      ed.grip[0].translate(pagePos() + p);
      }
示例#6
0
void Spacer::updateGrips(Grip* defaultGrip, QVector<QRectF>& grip) const
      {
      *defaultGrip   = Grip::START;
      qreal _spatium = spatium();
      QPointF p;
      switch (spacerType()) {
            case SpacerType::DOWN:
            case SpacerType::FIXED:
                  p = QPointF(_spatium * .5, _gap);
                  break;
            case SpacerType::UP:
                  p = QPointF(_spatium * .5, 0.0);
                  break;
            }
      grip[0].translate(pagePos() + p);
      }
示例#7
0
void Spacer::editDrag(const EditData& ed)
      {
      qreal s = ed.delta.y();

      switch (spacerType()) {
            case SpacerType::DOWN:
            case SpacerType::FIXED:
                  _gap += s;
                  break;
            case SpacerType::UP:
                  _gap -= s;
                  break;
            }
      if (_gap < spatium() * 2.0)
            _gap = spatium() * 2;
      layout0();
      score()->setLayoutAll();
      }
示例#8
0
void Spacer::layout0()
      {
      qreal _spatium = spatium();

      path    = QPainterPath();
      qreal w = _spatium;
      qreal b = w * .5;
      qreal h = _gap;

      switch (spacerType()) {
            case SpacerType::DOWN:
                  path.lineTo(w, 0.0);
                  path.moveTo(b, 0.0);
                  path.lineTo(b, h);
                  path.lineTo(0.0, h-b);
                  path.moveTo(b, h);
                  path.lineTo(w, h-b);
                  break;
            case SpacerType::UP:
                  path.moveTo(b, 0.0);
                  path.lineTo(0.0, b);
                  path.moveTo(b, 0.0);
                  path.lineTo(w, b);
                  path.moveTo(b, 0.0);
                  path.lineTo(b, h);
                  path.moveTo(0.0, h);
                  path.lineTo(w, h);
                  break;
            case SpacerType::FIXED:
                  path.lineTo(w, 0.0);
                  path.moveTo(b, 0.0);
                  path.lineTo(b, h);
                  path.moveTo(0.0, h);
                  path.lineTo(w, h);
                  break;
            }
      qreal lw = _spatium * 0.4;
      QRectF bb(0, 0, w, h);
      bb.adjust(-lw, -lw, lw, lw);
      setbbox(bb);
      }