MuseScore/libmscore/lyrics.h

97 lines
3.2 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 __LYRICS_H__
#define __LYRICS_H__
#include "text.h"
#include "chord.h"
2013-05-13 18:49:17 +02:00
class QPainter;
namespace Ms {
2012-05-26 14:26:10 +02:00
class Segment;
class Chord;
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ Lyrics
// @P syllabic enum SINGLE, BEGIN, END, MIDDLE
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Lyrics : public Text {
Q_OBJECT
Q_PROPERTY(Syllabic syllabic READ syllabic WRITE setSyllabic)
Q_ENUMS(Syllabic)
2013-01-11 18:10:18 +01:00
2012-05-26 14:26:10 +02:00
public:
enum Syllabic { SINGLE, BEGIN, END, MIDDLE };
private:
int _ticks; ///< if > 0 then draw an underline to tick() + _ticks
///< (melisma)
Syllabic _syllabic;
QList<Line*> _separator;
Text* _verseNumber;
protected:
int _no; ///< row index
public:
2012-11-26 15:54:08 +01:00
Lyrics(Score* = 0);
2012-05-26 14:26:10 +02:00
Lyrics(const Lyrics&);
~Lyrics();
2014-02-19 12:18:44 +01:00
virtual Lyrics* clone() const override { return new Lyrics(*this); }
virtual ElementType type() const override { return LYRICS; }
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
virtual bool acceptDrop(MuseScoreView*, const QPointF&, Element*) const override;
virtual Element* drop(const DropData&) override;
Segment* segment() const { return (Segment*)parent()->parent(); }
Measure* measure() const { return (Measure*)parent()->parent()->parent(); }
2012-05-26 14:26:10 +02:00
ChordRest* chordRest() const { return (ChordRest*)parent(); }
2014-02-19 12:18:44 +01:00
virtual void layout() override;
virtual void layout1() override;
2012-05-26 14:26:10 +02:00
2014-02-19 12:18:44 +01:00
virtual void write(Xml& xml) const override;
virtual void read(XmlReader&) override;
2012-05-26 14:26:10 +02:00
void setNo(int n);
int no() const { return _no; }
void setSyllabic(Syllabic s) { _syllabic = s; }
Syllabic syllabic() const { return _syllabic; }
2014-02-19 12:18:44 +01:00
virtual void add(Element*) override;
virtual void remove(Element*) override;
virtual void draw(QPainter*) const override;
virtual void endEdit() override;
2012-05-26 14:26:10 +02:00
int ticks() const { return _ticks; }
void setTicks(int tick) { _ticks = tick; }
2012-05-26 14:26:10 +02:00
int endTick() const;
bool isMelisma() const { return _ticks > 0; }
2012-05-26 14:26:10 +02:00
void clearSeparator() { _separator.clear(); } // TODO: memory leak
QList<Line*>* separatorList() { return &_separator; }
2014-02-19 12:18:44 +01:00
virtual void paste() override;
Text* verseNumber() const { return _verseNumber; }
void setVerseNumber(Text* t) { _verseNumber = t; }
2014-02-19 12:18:44 +01:00
virtual QVariant getProperty(P_ID propertyId) const override;
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
virtual QVariant propertyDefault(P_ID id) const override;
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