2013-08-22 12:18:14 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
2016-11-15 16:33:27 +01:00
|
|
|
// Copyright (C) 2002-2016 Werner Schweer
|
2013-08-22 12:18:14 +02:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __TIE_H__
|
|
|
|
#define __TIE_H__
|
|
|
|
|
2016-11-15 16:33:27 +01:00
|
|
|
#include "slurtie.h"
|
2013-08-22 12:18:14 +02:00
|
|
|
|
|
|
|
namespace Ms {
|
2016-11-15 16:33:27 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// @@ TieSegment
|
|
|
|
/// a single segment of slur; also used for Tie
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-12-21 14:03:45 +01:00
|
|
|
class TieSegment final : public SlurTieSegment
|
|
|
|
{
|
2016-11-15 16:33:27 +01:00
|
|
|
QPointF autoAdjustOffset;
|
|
|
|
|
|
|
|
void setAutoAdjust(const QPointF& offset);
|
|
|
|
void setAutoAdjust(qreal x, qreal y) { setAutoAdjust(QPointF(x, y)); }
|
|
|
|
QPointF getAutoAdjust() const { return autoAdjustOffset; }
|
|
|
|
|
|
|
|
protected:
|
2020-03-25 15:06:32 +01:00
|
|
|
void changeAnchor(EditData&, Element*) override;
|
2016-11-15 16:33:27 +01:00
|
|
|
|
|
|
|
public:
|
2020-05-29 18:47:27 +02:00
|
|
|
TieSegment(Score* s)
|
|
|
|
: SlurTieSegment(s) { autoAdjustOffset = QPointF(); }
|
|
|
|
TieSegment(const TieSegment& s)
|
|
|
|
: SlurTieSegment(s) { autoAdjustOffset = QPointF(); }
|
2020-03-25 15:06:32 +01:00
|
|
|
|
|
|
|
TieSegment* clone() const override { return new TieSegment(*this); }
|
|
|
|
ElementType type() const override { return ElementType::TIE_SEGMENT; }
|
|
|
|
int subtype() const override { return static_cast<int>(spanner()->type()); }
|
|
|
|
void draw(QPainter*) const override;
|
2016-11-15 16:33:27 +01:00
|
|
|
|
|
|
|
void layoutSegment(const QPointF& p1, const QPointF& p2);
|
|
|
|
|
|
|
|
bool isEdited() const;
|
2020-03-25 15:06:32 +01:00
|
|
|
void editDrag(EditData&) override;
|
|
|
|
bool edit(EditData&) override;
|
2016-11-15 16:33:27 +01:00
|
|
|
|
|
|
|
Tie* tie() const { return (Tie*)spanner(); }
|
|
|
|
|
2020-03-25 15:06:32 +01:00
|
|
|
void computeBezier(QPointF so = QPointF()) override;
|
2016-11-15 16:33:27 +01:00
|
|
|
};
|
2013-08-22 12:18:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// @@ Tie
|
2014-05-16 13:44:32 +02:00
|
|
|
//! a Tie has a Note as startElement/endElement
|
2013-08-22 12:18:14 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-12-21 14:03:45 +01:00
|
|
|
class Tie final : public SlurTie
|
|
|
|
{
|
2013-08-22 12:18:14 +02:00
|
|
|
static Note* editStartNote;
|
|
|
|
static Note* editEndNote;
|
2020-03-25 15:06:32 +01:00
|
|
|
|
2020-05-26 15:54:26 +02:00
|
|
|
public:
|
2020-03-25 15:06:32 +01:00
|
|
|
Tie(Score* = 0);
|
2016-11-15 16:33:27 +01:00
|
|
|
|
2013-08-22 12:18:14 +02:00
|
|
|
Tie* clone() const override { return new Tie(*this); }
|
2016-11-15 16:33:27 +01:00
|
|
|
ElementType type() const override { return ElementType::TIE; }
|
|
|
|
|
2014-02-22 21:29:29 +01:00
|
|
|
void setStartNote(Note* note);
|
2020-03-25 15:06:32 +01:00
|
|
|
void setEndNote(Note* note) { setEndElement((Element*)note); }
|
|
|
|
Note* startNote() const;
|
|
|
|
Note* endNote() const;
|
2016-11-15 16:33:27 +01:00
|
|
|
|
2018-09-27 16:28:25 +02:00
|
|
|
void calculateDirection();
|
|
|
|
void write(XmlWriter& xml) const override;
|
|
|
|
void slurPos(SlurPos*) override;
|
2017-07-19 17:53:45 +02:00
|
|
|
|
2018-11-25 23:35:00 +01:00
|
|
|
TieSegment* layoutFor(System*);
|
|
|
|
TieSegment* layoutBack(System*);
|
2016-11-15 16:33:27 +01:00
|
|
|
|
2020-03-25 15:06:32 +01:00
|
|
|
TieSegment* frontSegment() { return toTieSegment(Spanner::frontSegment()); }
|
|
|
|
const TieSegment* frontSegment() const { return toTieSegment(Spanner::frontSegment()); }
|
2018-11-25 23:35:00 +01:00
|
|
|
TieSegment* backSegment() { return toTieSegment(Spanner::backSegment()); }
|
|
|
|
const TieSegment* backSegment() const { return toTieSegment(Spanner::backSegment()); }
|
2020-03-25 15:06:32 +01:00
|
|
|
TieSegment* segmentAt(int n) { return toTieSegment(Spanner::segmentAt(n)); }
|
2013-08-22 12:18:14 +02:00
|
|
|
const TieSegment* segmentAt(int n) const { return toTieSegment(Spanner::segmentAt(n)); }
|
|
|
|
|
2018-11-25 23:35:00 +01:00
|
|
|
SlurTieSegment* newSlurTieSegment() override { return new TieSegment(score()); }
|
2020-05-26 15:54:26 +02:00
|
|
|
};
|
2013-08-22 12:18:14 +02:00
|
|
|
} // namespace Ms
|
|
|
|
#endif
|