2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
2016-11-15 16:33:27 +01:00
|
|
|
// Copyright (C) 2002-2016 Werner Schweer
|
2012-05-26 14:26:10 +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 __SLUR_H__
|
|
|
|
#define __SLUR_H__
|
|
|
|
|
2016-11-15 16:33:27 +01:00
|
|
|
#include "slurtie.h"
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ SlurSegment
|
2015-04-24 02:23:37 +02:00
|
|
|
/// a single segment of slur; also used for Tie
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-12-21 14:03:45 +01:00
|
|
|
class SlurSegment final : public SlurTieSegment {
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
protected:
|
2017-07-26 09:59:24 +02:00
|
|
|
virtual void changeAnchor(EditData&, Element*);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
2016-11-15 16:33:27 +01:00
|
|
|
SlurSegment(Score* s) : SlurTieSegment(s) {}
|
|
|
|
SlurSegment(const SlurSegment& ss) : SlurTieSegment(ss) {}
|
|
|
|
|
|
|
|
virtual SlurSegment* clone() const override { return new SlurSegment(*this); }
|
2018-07-24 15:48:24 +02:00
|
|
|
virtual ElementType type() const override { return ElementType::SLUR_SEGMENT; }
|
2016-11-15 16:33:27 +01:00
|
|
|
virtual int subtype() const override { return static_cast<int>(spanner()->type()); }
|
|
|
|
virtual QString subtypeName() const override { return name(spanner()->type()); }
|
|
|
|
virtual void draw(QPainter*) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-05-05 18:28:39 +02:00
|
|
|
void layoutSegment(const QPointF& p1, const QPointF& p2);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-04-01 03:39:01 +02:00
|
|
|
bool isEdited() const;
|
2017-03-31 13:03:15 +02:00
|
|
|
virtual bool edit(EditData&) override;
|
|
|
|
virtual void updateGrips(EditData&) const override;
|
2015-01-19 12:37:17 +01:00
|
|
|
|
2016-11-15 16:33:27 +01:00
|
|
|
Slur* slur() const { return (Slur*)spanner(); }
|
2012-07-24 18:21:22 +02:00
|
|
|
|
2017-07-26 09:59:24 +02:00
|
|
|
virtual void computeBezier(QPointF so = QPointF());
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-13 19:44:03 +02:00
|
|
|
// @@ Slur
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-12-21 14:03:45 +01:00
|
|
|
class Slur final : public SlurTie {
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2013-06-16 23:33:37 +02:00
|
|
|
void slurPosChord(SlurPos*);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
2012-07-13 19:44:03 +02:00
|
|
|
Slur(Score* = 0);
|
2018-12-06 13:55:15 +01:00
|
|
|
~Slur() {}
|
2016-07-01 12:42:15 +02:00
|
|
|
virtual Slur* clone() const override { return new Slur(*this); }
|
2017-01-18 14:16:33 +01:00
|
|
|
virtual ElementType type() const override { return ElementType::SLUR; }
|
2016-11-19 11:51:21 +01:00
|
|
|
virtual void write(XmlWriter& xml) const override;
|
2016-07-01 12:42:15 +02:00
|
|
|
virtual void layout() override;
|
2016-07-10 12:00:57 +02:00
|
|
|
virtual SpannerSegment* layoutSystem(System*) override;
|
2016-07-01 12:42:15 +02:00
|
|
|
virtual void setTrack(int val) override;
|
|
|
|
virtual void slurPos(SlurPos*) override;
|
2016-11-15 16:33:27 +01:00
|
|
|
|
2018-11-25 23:35:00 +01:00
|
|
|
SlurSegment* frontSegment() { return toSlurSegment(Spanner::frontSegment()); }
|
|
|
|
const SlurSegment* frontSegment() const { return toSlurSegment(Spanner::frontSegment()); }
|
|
|
|
SlurSegment* backSegment() { return toSlurSegment(Spanner::backSegment()); }
|
|
|
|
const SlurSegment* backSegment() const { return toSlurSegment(Spanner::backSegment()); }
|
|
|
|
SlurSegment* segmentAt(int n) { return toSlurSegment(Spanner::segmentAt(n)); }
|
|
|
|
const SlurSegment* segmentAt(int n) const { return toSlurSegment(Spanner::segmentAt(n)); }
|
2016-11-15 16:33:27 +01:00
|
|
|
virtual SlurTieSegment* newSlurTieSegment() override { return new SlurSegment(score()); }
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|