MuseScore/libmscore/slur.h

82 lines
3.1 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// 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__
#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
/// a single segment of slur; also used for Tie
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class SlurSegment final : public SlurTieSegment {
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:
SlurSegment(Score* s) : SlurTieSegment(s) {}
SlurSegment(const SlurSegment& ss) : SlurTieSegment(ss) {}
virtual SlurSegment* clone() const override { return new SlurSegment(*this); }
virtual ElementType type() const override { return ElementType::SLUR_SEGMENT; }
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
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;
Slur* slur() const { return (Slur*)spanner(); }
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
//---------------------------------------------------------
class Slur final : public SlurTie {
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;
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)); }
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