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 __STYLE_H__
|
|
|
|
#define __STYLE_H__
|
|
|
|
|
|
|
|
#include "mscore.h"
|
|
|
|
#include "spatium.h"
|
|
|
|
#include "articulation.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Xml;
|
|
|
|
struct ChordDescription;
|
|
|
|
class PageFormat;
|
|
|
|
class ChordList;
|
|
|
|
class Element;
|
|
|
|
|
|
|
|
class TextStyleData;
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class TextStyle {
|
2013-02-25 00:18:14 +01:00
|
|
|
public:
|
|
|
|
enum Hidden {
|
|
|
|
HIDE_NEVER = 0,
|
|
|
|
HIDE_IN_EDITOR = 1,
|
|
|
|
HIDE_IN_LISTS = 2,
|
|
|
|
HIDE_ALWAYS = 0xFFFF
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2012-05-26 14:26:10 +02:00
|
|
|
QSharedDataPointer<TextStyleData> d;
|
2013-02-25 00:18:14 +01:00
|
|
|
Hidden _hidden; // read-only parameter for text style visibility in various program places
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
TextStyle();
|
|
|
|
TextStyle(QString _name, QString _family,
|
|
|
|
qreal _size,
|
|
|
|
bool _bold, bool _italic, bool _underline,
|
|
|
|
Align _align,
|
|
|
|
const QPointF& _off = QPointF(), OffsetType _ot = OFFSET_SPATIUM,
|
|
|
|
const QPointF& _roff = QPointF(),
|
|
|
|
bool sd = false,
|
2012-09-10 09:57:35 +02:00
|
|
|
Spatium fw = Spatium(0.0), Spatium pw = Spatium(0.0), int fr = 25,
|
2012-05-26 14:26:10 +02:00
|
|
|
QColor co = QColor(Qt::black), bool circle = false, bool systemFlag = false,
|
2013-02-25 00:18:14 +01:00
|
|
|
QColor fg = QColor(Qt::black), QColor bg = QColor(255, 255, 255, 0), Hidden hidden = HIDE_NEVER);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
TextStyle(const TextStyle&);
|
|
|
|
~TextStyle();
|
|
|
|
TextStyle& operator=(const TextStyle&);
|
|
|
|
|
2013-02-25 00:18:14 +01:00
|
|
|
friend class TextStyleDialog; // allow TextStyleDialog to access _hidden without making it globally writeable
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
QString name() const;
|
|
|
|
QString family() const;
|
|
|
|
qreal size() const;
|
|
|
|
bool bold() const;
|
|
|
|
bool italic() const;
|
|
|
|
bool underline() const;
|
|
|
|
bool hasFrame() const;
|
|
|
|
Align align() const;
|
|
|
|
OffsetType offsetType() const;
|
|
|
|
const QPointF& offset() const;
|
|
|
|
QPointF offset(qreal spatium) const;
|
|
|
|
const QPointF& reloff() const;
|
|
|
|
void setReloff(const QPointF& p);
|
|
|
|
bool sizeIsSpatiumDependent() const;
|
2012-09-10 09:57:35 +02:00
|
|
|
|
|
|
|
Spatium frameWidth() const;
|
|
|
|
Spatium paddingWidth() const;
|
|
|
|
qreal frameWidthMM() const;
|
|
|
|
qreal paddingWidthMM() const;
|
|
|
|
void setFrameWidth(Spatium v);
|
|
|
|
void setPaddingWidth(Spatium v);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
int frameRound() const;
|
|
|
|
QColor frameColor() const;
|
|
|
|
bool circle() const;
|
|
|
|
bool systemFlag() const;
|
|
|
|
QColor foregroundColor() const;
|
2012-07-20 21:46:31 +02:00
|
|
|
QColor backgroundColor() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setName(const QString& s);
|
|
|
|
void setFamily(const QString& s);
|
|
|
|
void setSize(qreal v);
|
|
|
|
void setBold(bool v);
|
|
|
|
void setItalic(bool v);
|
|
|
|
void setUnderline(bool v);
|
|
|
|
void setHasFrame(bool v);
|
|
|
|
void setAlign(Align v);
|
|
|
|
void setXoff(qreal v);
|
|
|
|
void setYoff(qreal v);
|
|
|
|
void setOffsetType(OffsetType v);
|
|
|
|
void setRxoff(qreal v);
|
|
|
|
void setRyoff(qreal v);
|
|
|
|
void setSizeIsSpatiumDependent(bool v);
|
|
|
|
void setFrameRound(int v);
|
|
|
|
void setFrameColor(const QColor& v);
|
|
|
|
void setCircle(bool v);
|
|
|
|
void setSystemFlag(bool v);
|
|
|
|
void setForegroundColor(const QColor& v);
|
2012-07-20 21:46:31 +02:00
|
|
|
void setBackgroundColor(const QColor& v);
|
2013-02-25 00:18:14 +01:00
|
|
|
Hidden hidden() const { return _hidden; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void write(Xml& xml) const;
|
|
|
|
void writeProperties(Xml& xml) const;
|
2013-01-11 18:10:18 +01:00
|
|
|
void read(XmlReader& v);
|
|
|
|
bool readProperties(XmlReader& v);
|
2012-05-26 14:26:10 +02:00
|
|
|
QFont font(qreal space) const;
|
|
|
|
QFont fontPx(qreal spatium) const;
|
|
|
|
QRectF bbox(qreal space, const QString& s) const;
|
|
|
|
QFontMetricsF fontMetrics(qreal space) const;
|
|
|
|
bool operator!=(const TextStyle& s) const;
|
|
|
|
void layout(Element*) const;
|
|
|
|
void setFont(const QFont& f);
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// StyleValueType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
enum StyleValueType {
|
|
|
|
ST_SPATIUM, ST_DOUBLE, ST_BOOL, ST_INT, ST_DIRECTION, ST_STRING
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// StyleType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class StyleType {
|
|
|
|
const char* _name; // xml name for read()/write()
|
|
|
|
StyleValueType _valueType;
|
|
|
|
|
|
|
|
public:
|
2013-07-23 16:43:56 +02:00
|
|
|
StyleType() { _name = 0; }
|
2012-05-26 14:26:10 +02:00
|
|
|
StyleType(const char* n, StyleValueType v) : _name(n), _valueType(v) {}
|
|
|
|
StyleValueType valueType() const { return _valueType; }
|
|
|
|
const char* name() const { return _name; }
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// StyleIdx
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
enum StyleIdx {
|
|
|
|
ST_staffUpperBorder,
|
|
|
|
ST_staffLowerBorder,
|
|
|
|
ST_staffDistance,
|
|
|
|
ST_akkoladeDistance,
|
|
|
|
|
|
|
|
ST_minSystemDistance,
|
|
|
|
ST_maxSystemDistance,
|
|
|
|
|
|
|
|
ST_lyricsDistance,
|
|
|
|
ST_lyricsMinBottomDistance,
|
|
|
|
ST_lyricsLineHeight,
|
|
|
|
|
|
|
|
ST_figuredBassFontFamily,
|
|
|
|
ST_figuredBassFontSize,
|
|
|
|
ST_figuredBassYOffset,
|
|
|
|
ST_figuredBassLineHeight,
|
2013-02-10 13:34:08 +01:00
|
|
|
ST_figuredBassAlignment,
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_figuredBassStyle,
|
|
|
|
ST_systemFrameDistance,
|
|
|
|
ST_frameSystemDistance,
|
|
|
|
ST_minMeasureWidth,
|
|
|
|
|
|
|
|
ST_barWidth,
|
|
|
|
ST_doubleBarWidth,
|
|
|
|
ST_endBarWidth,
|
|
|
|
ST_doubleBarDistance,
|
|
|
|
ST_endBarDistance,
|
|
|
|
ST_repeatBarTips,
|
|
|
|
ST_startBarlineSingle,
|
|
|
|
ST_startBarlineMultiple,
|
|
|
|
|
|
|
|
ST_bracketWidth,
|
|
|
|
ST_bracketDistance,
|
|
|
|
ST_akkoladeWidth,
|
|
|
|
ST_akkoladeBarDistance,
|
|
|
|
|
|
|
|
ST_clefLeftMargin,
|
|
|
|
ST_keysigLeftMargin,
|
|
|
|
ST_timesigLeftMargin,
|
|
|
|
|
|
|
|
ST_clefKeyRightMargin,
|
|
|
|
ST_clefBarlineDistance,
|
|
|
|
ST_stemWidth,
|
|
|
|
ST_shortenStem,
|
|
|
|
ST_shortStemProgression,
|
|
|
|
ST_shortestStem,
|
|
|
|
ST_beginRepeatLeftMargin,
|
|
|
|
ST_minNoteDistance,
|
|
|
|
ST_barNoteDistance,
|
2013-07-15 11:57:07 +02:00
|
|
|
ST_barAccidentalDistance,
|
2013-07-17 12:17:49 +02:00
|
|
|
ST_multiMeasureRestMargin,
|
|
|
|
ST_noteBarDistance,
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
ST_measureSpacing,
|
|
|
|
ST_staffLineWidth,
|
|
|
|
ST_ledgerLineWidth,
|
|
|
|
ST_ledgerLineLength,
|
|
|
|
ST_accidentalDistance,
|
|
|
|
ST_accidentalNoteDistance,
|
|
|
|
ST_beamWidth,
|
|
|
|
ST_beamDistance,
|
|
|
|
ST_beamMinLen,
|
|
|
|
|
2013-06-22 18:54:44 +02:00
|
|
|
ST_dotMag,
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_dotNoteDistance,
|
|
|
|
ST_dotRestDistance,
|
|
|
|
ST_dotDotDistance,
|
|
|
|
ST_propertyDistanceHead,
|
|
|
|
ST_propertyDistanceStem,
|
|
|
|
ST_propertyDistance,
|
|
|
|
ST_lastSystemFillLimit,
|
|
|
|
|
|
|
|
ST_hairpinY,
|
|
|
|
ST_hairpinHeight,
|
|
|
|
ST_hairpinContHeight,
|
2013-08-09 11:42:24 +02:00
|
|
|
ST_hairpinLineWidth,
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2012-10-27 14:46:35 +02:00
|
|
|
ST_pedalY,
|
2013-08-09 11:42:24 +02:00
|
|
|
ST_pedalLineWidth,
|
|
|
|
ST_pedalLineStyle,
|
|
|
|
|
2012-10-27 14:46:35 +02:00
|
|
|
ST_trillY,
|
2012-12-16 17:38:15 +01:00
|
|
|
ST_harmonyY,
|
|
|
|
ST_harmonyFretDist,
|
2013-03-14 16:52:10 +01:00
|
|
|
ST_minHarmonyDistance,
|
2012-10-27 14:46:35 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_showPageNumber,
|
|
|
|
ST_showPageNumberOne,
|
|
|
|
ST_pageNumberOddEven,
|
|
|
|
ST_showMeasureNumber,
|
|
|
|
ST_showMeasureNumberOne,
|
|
|
|
ST_measureNumberInterval,
|
|
|
|
ST_measureNumberSystem,
|
|
|
|
|
|
|
|
ST_measureNumberAllStaffs,
|
|
|
|
ST_smallNoteMag,
|
|
|
|
ST_graceNoteMag,
|
|
|
|
ST_smallStaffMag,
|
|
|
|
ST_smallClefMag,
|
|
|
|
ST_genClef,
|
|
|
|
ST_genKeysig,
|
|
|
|
ST_genTimesig,
|
|
|
|
ST_genCourtesyTimesig,
|
|
|
|
ST_genCourtesyKeysig,
|
|
|
|
ST_genCourtesyClef,
|
|
|
|
|
2013-06-21 08:50:55 +02:00
|
|
|
ST_useStandardNoteNames,
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_useGermanNoteNames,
|
2013-06-23 23:33:10 +02:00
|
|
|
ST_useSolfeggioNoteNames,
|
2013-06-21 08:50:55 +02:00
|
|
|
ST_lowerCaseMinorChords,
|
2013-06-10 00:27:28 +02:00
|
|
|
ST_chordStyle,
|
2013-05-13 21:36:10 +02:00
|
|
|
ST_chordsXmlFile,
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_chordDescriptionFile,
|
|
|
|
ST_concertPitch,
|
|
|
|
ST_createMultiMeasureRests,
|
|
|
|
ST_minEmptyMeasures,
|
|
|
|
ST_minMMRestWidth,
|
|
|
|
ST_hideEmptyStaves,
|
|
|
|
ST_dontHideStavesInFirstSystem,
|
|
|
|
ST_gateTime,
|
|
|
|
ST_tenutoGateTime,
|
|
|
|
ST_staccatoGateTime,
|
|
|
|
ST_slurGateTime,
|
|
|
|
|
|
|
|
ST_ArpeggioNoteDistance,
|
|
|
|
ST_ArpeggioLineWidth,
|
|
|
|
ST_ArpeggioHookLen,
|
|
|
|
ST_FixMeasureNumbers,
|
|
|
|
ST_FixMeasureWidth,
|
|
|
|
|
|
|
|
ST_SlurEndWidth,
|
|
|
|
ST_SlurMidWidth,
|
|
|
|
ST_SlurDottedWidth,
|
|
|
|
|
|
|
|
ST_SectionPause,
|
|
|
|
ST_MusicalSymbolFont,
|
|
|
|
|
|
|
|
ST_showHeader,
|
|
|
|
ST_headerStyled,
|
|
|
|
ST_headerFirstPage,
|
|
|
|
ST_headerOddEven,
|
|
|
|
ST_evenHeaderL,
|
|
|
|
ST_evenHeaderC,
|
|
|
|
ST_evenHeaderR,
|
|
|
|
ST_oddHeaderL,
|
|
|
|
ST_oddHeaderC,
|
|
|
|
ST_oddHeaderR,
|
|
|
|
|
|
|
|
ST_showFooter,
|
|
|
|
ST_footerStyled,
|
|
|
|
ST_footerFirstPage,
|
|
|
|
ST_footerOddEven,
|
|
|
|
ST_evenFooterL,
|
|
|
|
ST_evenFooterC,
|
|
|
|
ST_evenFooterR,
|
|
|
|
ST_oddFooterL,
|
|
|
|
ST_oddFooterC,
|
|
|
|
ST_oddFooterR,
|
|
|
|
|
|
|
|
ST_voltaY,
|
|
|
|
ST_voltaHook,
|
|
|
|
ST_voltaLineWidth,
|
2013-08-08 11:38:32 +02:00
|
|
|
ST_voltaLineStyle,
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
ST_ottavaY,
|
|
|
|
ST_ottavaHook,
|
|
|
|
ST_ottavaLineWidth,
|
2013-08-08 11:38:32 +02:00
|
|
|
ST_ottavaLineStyle,
|
2013-08-10 21:02:21 +02:00
|
|
|
ST_ottavaNumbersOnly,
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
ST_tabClef,
|
|
|
|
|
2012-11-14 12:24:08 +01:00
|
|
|
ST_tremoloWidth,
|
|
|
|
ST_tremoloBoxHeight,
|
|
|
|
ST_tremoloStrokeWidth,
|
|
|
|
ST_tremoloDistance,
|
|
|
|
|
2013-04-29 15:31:22 +02:00
|
|
|
ST_linearStretch,
|
2013-05-12 12:51:42 +02:00
|
|
|
ST_crossMeasureValues,
|
2013-05-18 10:38:12 +02:00
|
|
|
ST_keySigNaturals,
|
2013-04-29 15:31:22 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
ST_STYLES
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// MStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class StyleData;
|
|
|
|
|
|
|
|
class MStyle {
|
|
|
|
QSharedDataPointer<StyleData> d;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MStyle();
|
|
|
|
MStyle(const MStyle&);
|
|
|
|
MStyle& operator=(const MStyle&);
|
|
|
|
~MStyle();
|
|
|
|
|
|
|
|
bool isDefault(StyleIdx idx) const;
|
|
|
|
const ChordDescription* chordDescription(int id) const;
|
2013-06-24 11:03:48 +02:00
|
|
|
ChordList* chordList();
|
2013-06-11 20:26:16 +02:00
|
|
|
void setChordList(ChordList*, bool custom = true); // Style gets ownership of ChordList
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
const TextStyle& textStyle(int) const;
|
|
|
|
const TextStyle& textStyle(const QString& name) const;
|
|
|
|
int textStyleType(const QString& name) const;
|
|
|
|
void setTextStyle(const TextStyle& ts);
|
|
|
|
void addTextStyle(const TextStyle& ts);
|
|
|
|
void removeTextStyle(const TextStyle& ts);
|
|
|
|
const QList<TextStyle>& textStyles() const;
|
|
|
|
void set(StyleIdx t, Spatium val);
|
|
|
|
void set(StyleIdx t, const QString& val);
|
|
|
|
void set(StyleIdx t, bool val);
|
|
|
|
void set(StyleIdx t, qreal val);
|
|
|
|
void set(StyleIdx t, int val);
|
2012-08-04 15:46:43 +02:00
|
|
|
void set(StyleIdx t, MScore::Direction val);
|
2013-08-09 11:42:24 +02:00
|
|
|
void set(StyleIdx t, const QVariant& v);
|
|
|
|
|
|
|
|
QVariant value(StyleIdx idx) const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
bool load(QFile* qf);
|
2013-01-11 18:10:18 +01:00
|
|
|
void load(XmlReader& e);
|
2012-05-26 14:26:10 +02:00
|
|
|
void save(Xml& xml, bool optimize);
|
|
|
|
const PageFormat* pageFormat() const;
|
|
|
|
void setPageFormat(const PageFormat& pf);
|
|
|
|
qreal spatium() const;
|
|
|
|
void setSpatium(qreal v);
|
|
|
|
ArticulationAnchor articulationAnchor(int id) const;
|
|
|
|
void setArticulationAnchor(int id, ArticulationAnchor val);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern QVector<TextStyle> defaultTextStyles;
|
|
|
|
extern const TextStyle defaultTextStyleArray[];
|
|
|
|
|
|
|
|
extern void initStyle(MStyle*);
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|