示例#1
0
void ScoreView::endEdit()
      {
      setDropTarget(0);
      if (!editObject)
            return;

      _score->addRefresh(editObject->canvasBoundingRect());
      for (int i = 0; i < grips; ++i)
            score()->addRefresh(grip[i]);

      editObject->endEdit();
      if (mscore->getInspector())
            mscore->getInspector()->setElement(0);

      _score->addRefresh(editObject->canvasBoundingRect());

      int tp = editObject->type();
      if (tp == Element::LYRICS)
            lyricsEndEdit();
      else if (tp == Element::HARMONY)
            harmonyEndEdit();
      else if (tp == Element::FIGURED_BASS)
            figuredBassEndEdit();
      _score->endCmd();
      mscore->endCmd();

      if (dragElement && (dragElement != editObject)) {
            curElement = dragElement;
            _score->select(curElement);
            _score->end();
            }
      editObject     = 0;
      grips          = 0;
      }
示例#2
0
void ScoreView::endEdit()
      {
      setDropTarget(0);
      if (!editObject)
            return;
      editObject->endEditDrag(data);
      _score->addRefresh(editObject->canvasBoundingRect());
      for (int i = 0; i < grips; ++i)
            score()->addRefresh(grip[i]);

      if (editObject->userOff() != editObject->startDragPosition())
            editObject->undoChangeProperty(P_ID::AUTOPLACE, false);
      editObject->endEdit();

      _score->addRefresh(editObject->canvasBoundingRect());

      ElementType tp = editObject->type();
      if (tp == ElementType::LYRICS)
            lyricsEndEdit();
      else if (tp == ElementType::HARMONY)
            harmonyEndEdit();
      else if (tp == ElementType::FIGURED_BASS)
            figuredBassEndEdit();
      else if (editObject->isText()) {
            Text* text = static_cast<Text*>(editObject);
            // remove text if empty
            // dont do this for TBOX
            if (text->empty() && text->parent() && text->parent()->type() != ElementType::TBOX)
                  _score->undoRemoveElement(text);
            }

      _score->endCmd();

      if (dragElement && (dragElement != editObject)) {
            curElement = dragElement;
            _score->select(curElement);
            _score->update();
            }
      mscore->updateInspector();

      editObject = nullptr;
      grips      = 0;
      curGrip    = Grip::NO_GRIP;
      }