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
|
2014-05-16 13:44:32 +02:00
|
|
|
// @P syllabic Ms::Lyrics::Syllabic (SINGLE, BEGIN, END, MIDDLE)
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Lyrics : public Text {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
2014-06-25 17:09:44 +02:00
|
|
|
Q_PROPERTY(Ms::Lyrics::Syllabic syllabic READ syllabic WRITE setSyllabic)
|
2012-12-07 16:42:41 +01:00
|
|
|
Q_ENUMS(Syllabic)
|
2013-01-11 18:10:18 +01:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
2014-05-22 21:51:34 +02:00
|
|
|
enum class Syllabic : char { SINGLE, BEGIN, END, MIDDLE };
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
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-06-24 18:36:02 +02:00
|
|
|
virtual Lyrics* clone() const override { return new Lyrics(*this); }
|
|
|
|
virtual Element::Type type() const override { return Element::Type::LYRICS; }
|
2014-02-19 12:18:44 +01:00
|
|
|
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
|
|
|
|
2012-10-31 10:15:45 +01:00
|
|
|
int ticks() const { return _ticks; }
|
|
|
|
void setTicks(int tick) { _ticks = tick; }
|
2012-05-26 14:26:10 +02:00
|
|
|
int endTick() const;
|
2012-10-31 10:15:45 +01:00
|
|
|
bool isMelisma() const { return _ticks > 0; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2012-10-31 10:15:45 +01:00
|
|
|
void clearSeparator() { _separator.clear(); } // TODO: memory leak
|
|
|
|
QList<Line*>* separatorList() { return &_separator; }
|
2014-03-22 14:54:15 +01:00
|
|
|
|
|
|
|
using Text::paste;
|
|
|
|
void paste(MuseScoreView * scoreview);
|
|
|
|
|
2012-10-31 10:15:45 +01:00
|
|
|
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
|
2014-05-16 14:17:03 +02:00
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Ms::Lyrics::Syllabic);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|