2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2010-2011 Werner Schweer
|
|
|
|
//
|
|
|
|
// 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 __STEM_H__
|
|
|
|
#define __STEM_H__
|
|
|
|
|
|
|
|
#include "element.h"
|
|
|
|
|
|
|
|
class QPainter;
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
|
|
|
class Chord;
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Stem
|
2014-05-16 13:44:32 +02:00
|
|
|
/// Graphic representation of a note stem.
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Stem : public Element {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
QLineF line; // p1 is attached to note head
|
|
|
|
qreal _userLen;
|
|
|
|
qreal _len; // allways positive
|
|
|
|
|
2013-10-03 16:11:59 +02:00
|
|
|
virtual void startEdit(MuseScoreView*, const QPointF&);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
2015-03-18 12:17:01 +01:00
|
|
|
Stem(Score* = 0);
|
2014-06-27 13:41:49 +02:00
|
|
|
Stem &operator=(const Stem&) = delete;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Stem* clone() const { return new Stem(*this); }
|
|
|
|
virtual Element::Type type() const { return Element::Type::STEM; }
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual void draw(QPainter*) const;
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual bool isEditable() const { return true; }
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual void layout();
|
|
|
|
virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);
|
|
|
|
|
|
|
|
virtual void editDrag(const EditData&);
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void updateGrips(Grip*, QVector<QRectF>&) const;
|
|
|
|
virtual int grips() const override { return 1; }
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual void write(Xml& xml) const;
|
2013-01-11 18:10:18 +01:00
|
|
|
virtual void read(XmlReader& e);
|
2012-11-19 10:08:15 +01:00
|
|
|
virtual void reset();
|
2014-08-13 21:01:21 +02:00
|
|
|
virtual bool acceptDrop(const DropData&) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual Element* drop(const DropData&);
|
|
|
|
|
|
|
|
virtual QVariant getProperty(P_ID propertyId) const;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&);
|
|
|
|
|
|
|
|
Chord* chord() const { return (Chord*)parent(); }
|
|
|
|
bool up() const;
|
|
|
|
|
|
|
|
qreal userLen() const { return _userLen; }
|
|
|
|
void setUserLen(qreal l) { _userLen = l; }
|
|
|
|
|
2013-01-02 09:29:17 +01:00
|
|
|
qreal lineWidth() const;
|
|
|
|
|
2013-03-13 15:24:03 +01:00
|
|
|
QPointF hookPos() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setLen(qreal l);
|
|
|
|
qreal len() const { return _len; }
|
|
|
|
qreal stemLen() const;
|
2012-07-24 18:21:22 +02:00
|
|
|
QPointF p2() const { return line.p2(); }
|
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
|
|
|
|
|