Beispiel #1
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));
      }
Beispiel #2
0
void Hairpin::reset()
      {
      if (lineWidthStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::LINE_WIDTH, propertyDefault(P_ID::LINE_WIDTH), PropertyStyle::STYLED);
      if (hairpinHeightStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::HAIRPIN_HEIGHT, propertyDefault(P_ID::HAIRPIN_HEIGHT), PropertyStyle::STYLED);
      if (hairpinContHeightStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::HAIRPIN_CONT_HEIGHT, propertyDefault(P_ID::HAIRPIN_CONT_HEIGHT), PropertyStyle::STYLED);
      TextLine::reset();
      }
Beispiel #3
0
void Articulation::reset()
      {
#if 0
      if (_direction != Direction_AUTO)
            undoChangeProperty(P_ID::DIRECTION, Direction_AUTO);
      ArticulationAnchor a = score()->style()->articulationAnchor(int(articulationType()));
      if (_anchor != a)
            undoChangeProperty(P_ID::ARTICULATION_ANCHOR, int(a));
#endif
      Element::reset();
      }
Beispiel #4
0
void Ottava::reset()
      {
      if (lineWidthStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::LINE_WIDTH, propertyDefault(P_ID::LINE_WIDTH), PropertyStyle::STYLED);
      if (lineStyleStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::LINE_STYLE, propertyDefault(P_ID::LINE_STYLE), PropertyStyle::STYLED);
      if (numbersOnlyStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::NUMBERS_ONLY, propertyDefault(P_ID::NUMBERS_ONLY), PropertyStyle::STYLED);
      if (beginTextStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::BEGIN_TEXT, propertyDefault(P_ID::BEGIN_TEXT), PropertyStyle::STYLED);
      if (continueTextStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::CONTINUE_TEXT, propertyDefault(P_ID::CONTINUE_TEXT), PropertyStyle::STYLED);

      setOttavaType(_ottavaType);
      TextLine::reset();
      }
Beispiel #5
0
void Marker::undoSetMarkerType(Type t)
      {
      undoChangeProperty(P_ID::MARKER_TYPE, int(t));
      }
Beispiel #6
0
void Hairpin::undoSetVeloChange(int val)
      {
      undoChangeProperty(P_ID::VELO_CHANGE, val);
      }
void LayoutBreak::undoSetLayoutBreakType(Type t)
      {
      undoChangeProperty(P_ID::LAYOUT_BREAK, int(t));
      }
Beispiel #8
0
void Glissando::undoSetShowText(bool f)
      {
      undoChangeProperty(P_ID::GLISS_SHOW_TEXT, f);
      }
Beispiel #9
0
void Glissando::undoSetGlissandoType(Type t)
      {
      undoChangeProperty(P_ID::GLISS_TYPE, int(t));
      }
Beispiel #10
0
void Jump::undoSetJumpTo(const QString& s)
      {
      undoChangeProperty(P_ID::JUMP_TO, s);
      }
Beispiel #11
0
void ChordRest::undoSetSmall(bool val)
      {
      undoChangeProperty(P_ID::SMALL, val);
      }
Beispiel #12
0
void ChordRest::undoSetBeamMode(Beam::Mode mode)
      {
      undoChangeProperty(P_ID::BEAM_MODE, int(mode));
      }
Beispiel #13
0
void Accidental::undoSetSmall(bool val)
      {
      undoChangeProperty(P_ID::SMALL, val);
      }
Beispiel #14
0
void Accidental::undoSetHasBracket(bool val)
      {
      undoChangeProperty(P_ID::ACCIDENTAL_BRACKET, val);
      }
Beispiel #15
0
void TremoloBar::reset()
      {
      if (lineWidthStyle == PropertyFlags::UNSTYLED)
            undoChangeProperty(Pid::LINE_WIDTH, propertyDefault(Pid::LINE_WIDTH), PropertyFlags::STYLED);
      Element::reset();
      }
Beispiel #16
0
void Clef::undoSetShowCourtesy(bool v)
      {
      undoChangeProperty(P_ID::SHOW_COURTESY, v);
      }
Beispiel #17
0
void Stem::reset()
      {
      undoChangeProperty(P_ID::USER_LEN, 0.0);
      Element::reset();
      }
Beispiel #18
0
void Jump::undoSetPlayUntil(const QString& s)
      {
      undoChangeProperty(P_ID::PLAY_UNTIL, s);
      }
Beispiel #19
0
void Glissando::undoSetText(const QString& s)
      {
      undoChangeProperty(P_ID::GLISS_TEXT, s);
      }
Beispiel #20
0
void Jump::undoSetContinueAt(const QString& s)
      {
      undoChangeProperty(P_ID::CONTINUE_AT, s);
      }
Beispiel #21
0
void SpannerSegment::reset()
      {
      undoChangeProperty(P_ID::USER_OFF2, QPointF());
      Element::reset();
      spanner()->reset();
      }
Beispiel #22
0
void Trill::undoSetTrillType(Type val)
      {
      undoChangeProperty(Pid::TRILL_TYPE, int(val));
      }
Beispiel #23
0
void Hairpin::undoSetHairpinType(Type val)
      {
      undoChangeProperty(P_ID::HAIRPIN_TYPE, int(val));
      }
Beispiel #24
0
void LayoutBreak::undoSetLayoutBreakType(LayoutBreakType t)
      {
      undoChangeProperty(P_LAYOUT_BREAK, t);
      }
Beispiel #25
0
void Hairpin::undoSetDynRange(Dynamic::Range val)
      {
      undoChangeProperty(P_ID::DYNAMIC_RANGE, int(val));
      }
Beispiel #26
0
void Volta::reset()
      {
      if (lineWidthStyle == PropertyStyle::UNSTYLED)
            undoChangeProperty(P_ID::LINE_WIDTH, propertyDefault(P_ID::LINE_WIDTH), PropertyStyle::STYLED);
      TextLineBase::reset();
      }
Beispiel #27
0
void Marker::undoSetLabel(const QString& s)
      {
      undoChangeProperty(P_ID::LABEL, s);
      }
Beispiel #28
0
void TempoText::undoSetTempo(qreal v)
      {
      undoChangeProperty(P_ID::TEMPO, v);
      }
Beispiel #29
0
void Volta::undoSetVoltaType(Type val)
      {
      undoChangeProperty(P_ID::VOLTA_TYPE, int(val));
      }
Beispiel #30
0
void TempoText::undoSetFollowText(bool v)
      {
      undoChangeProperty(P_ID::TEMPO_FOLLOW_TEXT, v);
      }