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__
|
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
#include "line.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
#include "text.h"
|
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
// uncomment the following line to use the actual metrics of
|
|
|
|
// the font used by each lyrics rather than conventional values
|
|
|
|
//
|
|
|
|
// NOTE: CURRENTLY DOES NOT WORK (Font::tightBoundingBox() returns unusable values for glyphs not on base line)
|
|
|
|
//
|
|
|
|
//#define USE_FONT_DASH_METRIC
|
|
|
|
|
|
|
|
#if defined(USE_FONT_DASH_METRIC)
|
|
|
|
// the following line is used to turn the single font dash thickness value on or off
|
|
|
|
// when the other font dash parameters are on;
|
|
|
|
// the rationale is that the dash thickness is the most unreliable of the dash parameters
|
|
|
|
// retrievable from font metrics and it may make sense to use the other values but ignore this one.
|
|
|
|
// #define USE_FONT_DASH_TICKNESS
|
|
|
|
#endif
|
2013-05-13 18:49:17 +02:00
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
namespace Ms {
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Lyrics
|
2015-04-24 00:55:46 +02:00
|
|
|
// @P syllabic enum (Lyrics.SINGLE, Lyrics.BEGIN, Lyrics.END, Lyrics.MIDDLE)
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
class LyricsLine;
|
|
|
|
|
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 };
|
2015-01-15 00:01:18 +01:00
|
|
|
// MELISMA FIRST UNDERSCORE:
|
|
|
|
// used as_ticks value to mark a melisma for which only the first chord has been spanned so far
|
|
|
|
// and to give the user a visible feedback that the undercore has been actually entered;
|
2015-01-23 23:50:49 +01:00
|
|
|
// it should be cleared to 0 at some point, so that it will not be carried over
|
|
|
|
// if the melisma is not extended beyond a single chord, but no suitable place to do this
|
|
|
|
// has been identified yet.
|
2015-01-15 00:01:18 +01:00
|
|
|
static const int TEMP_MELISMA_TICKS = 1;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-23 20:58:01 +01:00
|
|
|
// metrics for dashes and melisma; all in sp. units:
|
|
|
|
static constexpr qreal MELISMA_DEFAULT_PAD = 0.10; // the empty space before a melisma line
|
|
|
|
static constexpr qreal LYRICS_DASH_DEFAULT_PAD = 0.05; // the min. empty space before and after a dash
|
2015-10-03 23:55:33 +02:00
|
|
|
// WORD_MIN_DISTANCE has never been implemented
|
|
|
|
// static constexpr qreal LYRICS_WORD_MIN_DISTANCE = 0.33; // min. distance between lyrics from different words
|
2015-01-23 20:58:01 +01:00
|
|
|
// These values are used when USE_FONT_DASH_METRIC is not defined
|
|
|
|
#if !defined(USE_FONT_DASH_METRIC)
|
|
|
|
static constexpr qreal LYRICS_DASH_DEFAULT_LINE_THICKNESS = 0.15; // in sp. units
|
2016-09-08 10:54:27 +02:00
|
|
|
static constexpr qreal LYRICS_DASH_Y_POS_RATIO = 0.67; // the fraction of lyrics font x-height to
|
2015-01-23 20:58:01 +01:00
|
|
|
// raise the dashes above text base line;
|
2016-09-08 10:54:27 +02:00
|
|
|
#endif
|
2015-01-23 20:58:01 +01:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
private:
|
|
|
|
int _ticks; ///< if > 0 then draw an underline to tick() + _ticks
|
|
|
|
///< (melisma)
|
|
|
|
Syllabic _syllabic;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
LyricsLine* _separator;
|
2017-01-16 20:51:12 +01:00
|
|
|
PropertyFlags placementStyle;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int _no; ///< row index
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
#if defined(USE_FONT_DASH_METRIC)
|
|
|
|
qreal _dashY; // dash dimensions for lyrics line dashes
|
|
|
|
qreal _dashLength;
|
|
|
|
#if defined (USE_FONT_DASH_TICKNESS)
|
|
|
|
qreal _dashThickness;
|
|
|
|
#endif
|
|
|
|
#endif
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
2012-11-26 15:54:08 +01:00
|
|
|
Lyrics(Score* = 0);
|
2012-05-26 14:26:10 +02:00
|
|
|
Lyrics(const Lyrics&);
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
~Lyrics();
|
|
|
|
virtual Lyrics* clone() const override { return new Lyrics(*this); }
|
2017-01-18 14:16:33 +01:00
|
|
|
virtual ElementType type() const override { return ElementType::LYRICS; }
|
2014-02-19 12:18:44 +01:00
|
|
|
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
|
2014-08-13 21:01:21 +02:00
|
|
|
virtual bool acceptDrop(const DropData&) const override;
|
2014-02-19 12:18:44 +01:00
|
|
|
virtual Element* drop(const DropData&) override;
|
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
Segment* segment() const { return (Segment*)parent()->parent(); }
|
|
|
|
Measure* measure() const { return (Measure*)parent()->parent()->parent(); }
|
|
|
|
ChordRest* chordRest() const { return (ChordRest*)parent(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-02-19 12:18:44 +01:00
|
|
|
virtual void layout() override;
|
|
|
|
virtual void layout1() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-11-19 11:51:21 +01:00
|
|
|
virtual void write(XmlWriter& xml) const override;
|
2014-02-19 12:18:44 +01:00
|
|
|
virtual void read(XmlReader&) override;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
virtual int subtype() const override { return _no; }
|
|
|
|
virtual QString subtypeName() const override { return tr("Verse %1").arg(_no + 1); }
|
2012-05-26 14:26:10 +02:00
|
|
|
void setNo(int n);
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
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 endEdit() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
int ticks() const { return _ticks; }
|
|
|
|
void setTicks(int tick) { _ticks = tick; }
|
2012-05-26 14:26:10 +02:00
|
|
|
int endTick() const;
|
2014-09-17 04:44:26 +02:00
|
|
|
bool isMelisma() const;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
void removeFromScore();
|
|
|
|
|
|
|
|
#if defined(USE_FONT_DASH_METRIC)
|
|
|
|
qreal dashLength() const { return _dashLength; }
|
|
|
|
qreal dashY() const { return _dashY; }
|
|
|
|
#if defined (USE_FONT_DASH_TICKNESS)
|
|
|
|
qreal dashThickness() const { return _dashThickness; }
|
|
|
|
#endif
|
|
|
|
#endif
|
2014-08-13 21:01:21 +02:00
|
|
|
|
2014-03-22 14:54:15 +01:00
|
|
|
using Text::paste;
|
|
|
|
void paste(MuseScoreView * scoreview);
|
2014-08-13 21:01:21 +02:00
|
|
|
|
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;
|
2017-01-16 20:51:12 +01:00
|
|
|
virtual PropertyFlags propertyFlags(P_ID) const override;
|
2016-08-26 12:43:43 +02:00
|
|
|
virtual StyleIdx getPropertyStyle(P_ID) const override;
|
|
|
|
virtual void reset() override;
|
|
|
|
virtual void styleChanged() override;
|
|
|
|
virtual void resetProperty(P_ID id) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// LyricsLine
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class LyricsLine : public SLine {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
protected:
|
2016-09-08 10:54:27 +02:00
|
|
|
Lyrics* _nextLyrics;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
LyricsLine(Score* s);
|
|
|
|
LyricsLine(const LyricsLine&);
|
|
|
|
|
2016-09-08 10:54:27 +02:00
|
|
|
virtual LyricsLine* clone() const override { return new LyricsLine(*this); }
|
2017-01-18 14:16:33 +01:00
|
|
|
virtual ElementType type() const override { return ElementType::LYRICSLINE; }
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void layout() override;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
virtual LineSegment* createLineSegment() override;
|
2015-03-10 11:38:27 +01:00
|
|
|
virtual void removeUnmanaged() override;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
|
2016-09-08 10:54:27 +02:00
|
|
|
Lyrics* lyrics() const { return (Lyrics*)parent(); }
|
|
|
|
Lyrics* nextLyrics() const { return _nextLyrics; }
|
2015-03-10 11:38:27 +01:00
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant& v) override;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// LyricsLineSegment
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class LyricsLineSegment : public LineSegment {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
protected:
|
2016-09-08 10:54:27 +02:00
|
|
|
int _numOfDashes;
|
|
|
|
qreal _dashLength;
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
LyricsLineSegment(Score* s);
|
|
|
|
|
|
|
|
virtual LyricsLineSegment* clone() const override { return new LyricsLineSegment(*this); }
|
2017-01-18 14:16:33 +01:00
|
|
|
virtual ElementType type() const override { return ElementType::LYRICSLINE_SEGMENT; }
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01:00
|
|
|
virtual void draw(QPainter*) const override;
|
|
|
|
virtual void layout() override;
|
2016-09-08 10:54:27 +02:00
|
|
|
LyricsLine* lyricsLine() const { return (LyricsLine*)spanner(); }
|
Lyrics multi-system melisma and dashes
Implements melisma and dash lines for lyrics spanning several systems.
The melisma and dash line is based on the `SLine` class and its segments on the `LineSegment` class. Both the whole line and its segments are not selectable, marked as generated and not saved in the score file, which is not changed in any way.
For very wide dash segments, several dashes are drawn; the distance between the dashes is not configurable.
Lyrics layout code in `Measure` class and in `layout.cpp` file has been commented out as the lyrics line layout is all contained in the lyrics.cpp file
The line is registered with the `Score` (to have its layout delayed until all elements are positioned) with a mechanism similar to other `Spanner`'s, but in a different container (`_unmanagedSpanner`), as the owning `Lyrics` should decide when create, register, unregister and delete its line.
The line segments are registered with the `System` they belong to (to have them drawn), in the same way as other `Spanner`'s.
There is code for using the dash metrics of the lyrics font, but it is turned off via a conditional directive, as there does not seem to be a reliable way to determine the dash metrics; conventional values (determined by trials and errors and based on my taste!) are used when the conditional directive is off.
2015-01-11 10:11:44 +01: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
|
|
|
|
|