MuseScore/libmscore/rest.h

72 lines
2.3 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-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 __REST_H__
#define __REST_H__
#include "chordrest.h"
2013-05-13 18:49:17 +02:00
namespace Ms {
2012-05-26 14:26:10 +02:00
class TDuration;
//---------------------------------------------------------
2012-07-11 21:29:42 +02:00
// @@ Rest
2012-07-16 19:59:32 +02:00
/// This class implements a rest.
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Rest : public ChordRest {
Q_OBJECT
2012-05-26 14:26:10 +02:00
// values calculated by layout:
int _sym;
int dotline; // depends on rest symbol
qreal _mmWidth; // width of multi measure rest
2013-07-31 11:05:48 +02:00
virtual QRectF drag(const EditData&) override;
virtual qreal upPos() const override;
virtual qreal downPos() const override;
virtual qreal centerX() const override;
2012-05-26 14:26:10 +02:00
void setUserOffset(qreal x, qreal y);
public:
Rest(Score* s = 0);
Rest(Score*, const TDuration&);
2013-07-31 11:05:48 +02:00
virtual Rest* clone() const override { return new Rest(*this); }
virtual ElementType type() const override { return REST; }
2012-05-26 14:26:10 +02:00
2013-07-31 11:05:48 +02:00
virtual Measure* measure() const override { return parent() ? (Measure*)(parent()->parent()) : 0; }
virtual qreal mag() const override;
virtual void draw(QPainter*) const override;
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
2012-05-26 14:26:10 +02:00
2013-07-31 11:05:48 +02:00
virtual bool acceptDrop(MuseScoreView*, const QPointF&, Element*) const override;
virtual Element* drop(const DropData&) override;
virtual void layout() override;
2012-05-26 14:26:10 +02:00
2013-07-31 11:05:48 +02:00
virtual void reset() override;
2012-08-23 17:40:04 +02:00
2012-05-26 14:26:10 +02:00
void setMMWidth(qreal val);
qreal mmWidth() const { return _mmWidth; }
int getSymbol(TDuration::DurationType type, int line, int lines, int* yoffset);
int getDotline() const { return dotline; }
int sym() const { return _sym; }
int computeLineOffset();
bool isFullMeasureRest() const { return durationType() == TDuration::V_MEASURE; }
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