MuseScore/libmscore/property.h

401 lines
9 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 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 __PROPERTY_H__
#define __PROPERTY_H__
2013-05-13 18:49:17 +02:00
namespace Ms {
2013-01-11 18:10:18 +01:00
class XmlReader;
2018-03-27 15:36:00 +02:00
enum class Sid : int;
2016-02-09 13:51:19 +01:00
2018-03-27 14:40:34 +02:00
//------------------------------------------------------------------------
// M_PROPERTY (type, getter_name, setter_name)
// helper macro to define a styled ScoreElement property
//
// usage example:
// class Text : public Element {
2018-11-27 10:32:41 +01:00
// M_PROPERTY(QColor, color, setColor)
// ...
// };
2018-03-15 11:52:17 +01:00
// this defines:
2018-11-27 10:32:41 +01:00
// QColor _color;
// const QColor& color() const { return _color; }
// void setColor(const QColor& val) { _color = val; }
//---------------------------------------------------------
#define M_PROPERTY(a,b,c) \
a _ ## b; \
public: \
const a& b() const { return _ ## b; } \
void c(const a& val) { _ ## b = val; } \
private:
2018-03-27 14:40:34 +02:00
#define M_PROPERTY2(a,b,c,d) \
a _ ## b { d }; \
public: \
const a& b() const { return _ ## b; } \
void c(const a& val) { _ ## b = val; } \
private:
2014-03-13 16:21:30 +01:00
//---------------------------------------------------------
2017-01-16 20:51:12 +01:00
// PropertyFlags
2014-03-13 16:21:30 +01:00
//---------------------------------------------------------
2017-01-16 20:51:12 +01:00
enum class PropertyFlags : char {
2014-03-13 16:21:30 +01:00
NOSTYLE, UNSTYLED, STYLED
};
2012-05-26 14:26:10 +02:00
//------------------------------------------------------------------------
// Element Properties
//------------------------------------------------------------------------
2018-03-27 15:36:00 +02:00
enum class Pid {
2014-05-26 18:18:01 +02:00
SUBTYPE,
SELECTED,
2014-06-02 13:07:19 +02:00
GENERATED,
2014-05-26 18:18:01 +02:00
COLOR,
VISIBLE,
Z,
2014-05-26 18:18:01 +02:00
SMALL,
SHOW_COURTESY,
LINE_TYPE,
PITCH,
TPC1,
2016-06-01 10:47:27 +02:00
TPC2,
2014-05-26 18:18:01 +02:00
LINE,
FIXED,
FIXED_LINE,
2014-05-26 18:18:01 +02:00
HEAD_TYPE,
HEAD_GROUP,
VELO_TYPE,
VELO_OFFSET,
ARTICULATION_ANCHOR,
DIRECTION,
2016-06-01 10:47:27 +02:00
STEM_DIRECTION,
2014-05-26 18:18:01 +02:00
NO_STEM,
SLUR_DIRECTION,
LEADING_SPACE,
DISTRIBUTE,
MIRROR_HEAD,
DOT_POSITION,
TUNING,
PAUSE,
2016-06-01 10:47:27 +02:00
BARLINE_TYPE,
2016-02-04 11:27:47 +01:00
BARLINE_SPAN,
2014-05-26 18:18:01 +02:00
BARLINE_SPAN_FROM,
BARLINE_SPAN_TO,
OFFSET,
2014-05-26 18:18:01 +02:00
FRET,
STRING,
GHOST,
PLAY,
TIMESIG_NOMINAL,
TIMESIG_ACTUAL,
2016-06-01 10:47:27 +02:00
NUMBER_TYPE,
2014-05-26 18:18:01 +02:00
BRACKET_TYPE,
NORMAL_NOTES,
ACTUAL_NOTES,
P1,
P2,
GROW_LEFT,
GROW_RIGHT,
BOX_HEIGHT,
2014-05-26 18:18:01 +02:00
BOX_WIDTH,
TOP_GAP,
BOTTOM_GAP,
LEFT_MARGIN,
RIGHT_MARGIN,
TOP_MARGIN,
BOTTOM_MARGIN,
LAYOUT_BREAK,
AUTOSCALE,
SIZE,
2014-05-26 18:18:01 +02:00
SCALE,
LOCK_ASPECT_RATIO,
SIZE_IS_SPATIUM,
TEXT,
HTML_TEXT,
USER_MODIFIED,
BEAM_POS,
BEAM_MODE,
BEAM_NO_SLOPE,
USER_LEN, // used for stems
2014-05-26 18:18:01 +02:00
SPACE, // used for spacer
TEMPO,
TEMPO_FOLLOW_TEXT,
ACCIDENTAL_BRACKET,
ACCIDENTAL_TYPE,
2014-05-26 18:18:01 +02:00
NUMERATOR_STRING,
DENOMINATOR_STRING,
FBPREFIX, // used for FiguredBassItem
FBDIGIT, // " "
FBSUFFIX, // " "
FBCONTINUATIONLINE, // " "
2014-05-26 18:18:01 +02:00
FBPARENTHESIS1, // " "
FBPARENTHESIS2, // " "
FBPARENTHESIS3, // " "
FBPARENTHESIS4, // " "
FBPARENTHESIS5, // " "
OTTAVA_TYPE,
NUMBERS_ONLY,
TRILL_TYPE,
VIBRATO_TYPE,
2014-05-26 18:18:01 +02:00
HAIRPIN_CIRCLEDTIP,
2014-05-26 18:18:01 +02:00
HAIRPIN_TYPE,
HAIRPIN_HEIGHT,
HAIRPIN_CONT_HEIGHT,
VELO_CHANGE,
2018-12-22 11:43:23 +01:00
VELO_CHANGE_METHOD,
VELO_CHANGE_SPEED,
DYNAMIC_TYPE,
2014-05-26 18:18:01 +02:00
DYNAMIC_RANGE,
2018-12-22 11:43:23 +01:00
SINGLE_NOTE_DYNAMICS,
//100
2014-05-26 18:18:01 +02:00
PLACEMENT,
VELOCITY,
JUMP_TO,
PLAY_UNTIL,
CONTINUE_AT,
LABEL,
MARKER_TYPE,
ARP_USER_LEN1,
ARP_USER_LEN2,
2016-02-04 11:27:47 +01:00
REPEAT_END,
REPEAT_START,
REPEAT_JUMP,
2014-05-26 18:18:01 +02:00
MEASURE_NUMBER_MODE,
GLISS_TYPE,
GLISS_TEXT,
2014-05-26 18:18:01 +02:00
GLISS_SHOW_TEXT,
DIAGONAL,
GROUPS,
LINE_STYLE,
LINE_WIDTH,
LASSO_POS,
LASSO_SIZE,
TIME_STRETCH,
ORNAMENT_STYLE,
2014-05-26 18:18:01 +02:00
TIMESIG,
TIMESIG_GLOBAL,
TIMESIG_STRETCH,
TIMESIG_TYPE,
2014-05-26 18:18:01 +02:00
SPANNER_TICK,
2014-08-13 15:42:40 +02:00
SPANNER_TICKS,
2014-05-26 18:18:01 +02:00
SPANNER_TRACK2,
OFFSET2,
2014-05-26 18:18:01 +02:00
BREAK_MMR,
REPEAT_COUNT,
2014-05-26 18:18:01 +02:00
USER_STRETCH,
NO_OFFSET,
IRREGULAR,
2014-06-18 20:57:45 +02:00
ANCHOR,
2014-07-31 16:30:04 +02:00
SLUR_UOFF1,
SLUR_UOFF2,
SLUR_UOFF3,
SLUR_UOFF4,
2014-08-20 09:50:42 +02:00
STAFF_MOVE,
2016-08-24 14:49:34 +02:00
VERSE,
2014-08-27 10:31:52 +02:00
SYLLABIC,
LYRIC_TICKS,
2014-09-25 11:34:26 +02:00
VOLTA_ENDING,
LINE_VISIBLE,
2015-01-15 14:50:50 +01:00
MAG,
USE_DRUMSET,
DURATION,
DURATION_TYPE,
ROLE,
TRACK,
2019-02-08 14:24:28 +01:00
GLISSANDO_STYLE,
2015-11-02 11:20:40 +01:00
FRET_STRINGS,
FRET_FRETS,
FRET_NUT,
2015-11-02 11:20:40 +01:00
FRET_OFFSET,
FRET_NUM_POS,
2016-05-25 20:52:23 +02:00
SYSTEM_BRACKET,
2016-06-03 11:56:11 +02:00
GAP,
2016-06-03 16:51:17 +02:00
AUTOPLACE,
2016-06-30 20:22:36 +02:00
DASH_LINE_LEN,
DASH_GAP_LEN,
2016-08-02 17:00:49 +02:00
TICK,
2016-09-16 12:07:37 +02:00
PLAYBACK_VOICE1,
PLAYBACK_VOICE2,
PLAYBACK_VOICE3,
2016-09-16 12:07:37 +02:00
PLAYBACK_VOICE4,
SYMBOL,
PLAY_REPEATS,
CREATE_SYSTEM_HEADER,
2016-12-18 14:31:13 +01:00
STAFF_LINES,
LINE_DISTANCE,
STEP_OFFSET,
2016-12-18 14:31:13 +01:00
STAFF_SHOW_BARLINES,
STAFF_SHOW_LEDGERLINES,
STAFF_STEMLESS,
2016-12-18 14:31:13 +01:00
STAFF_NOTEHEAD_SCHEME,
STAFF_GEN_CLEF,
STAFF_GEN_TIMESIG,
STAFF_GEN_KEYSIG,
2016-12-23 12:05:18 +01:00
STAFF_YOFFSET,
STAFF_USERDIST,
STAFF_BARLINE_SPAN,
STAFF_BARLINE_SPAN_FROM,
STAFF_BARLINE_SPAN_TO,
2017-03-31 13:03:15 +02:00
BRACKET_SPAN,
2016-12-29 19:46:40 +01:00
BRACKET_COLUMN,
2016-12-30 10:58:53 +01:00
INAME_LAYOUT_POSITION,
2017-01-16 20:51:12 +01:00
SUB_STYLE,
2017-01-05 14:53:21 +01:00
FONT_FACE,
FONT_SIZE,
FONT_STYLE,
FRAME_TYPE,
2017-01-16 20:51:12 +01:00
FRAME_WIDTH,
FRAME_PADDING,
FRAME_ROUND,
FRAME_FG_COLOR,
//200
2017-01-16 20:51:12 +01:00
FRAME_BG_COLOR,
SIZE_SPATIUM_DEPENDENT,
2017-02-07 18:48:23 +01:00
ALIGN,
2017-01-16 20:51:12 +01:00
SYSTEM_FLAG,
2017-02-07 18:48:23 +01:00
BEGIN_TEXT,
2017-02-07 18:48:23 +01:00
BEGIN_TEXT_ALIGN,
BEGIN_TEXT_PLACE,
BEGIN_HOOK_TYPE,
BEGIN_HOOK_HEIGHT,
BEGIN_FONT_FACE,
BEGIN_FONT_SIZE,
BEGIN_FONT_STYLE,
2017-02-07 18:48:23 +01:00
BEGIN_TEXT_OFFSET,
2017-02-07 18:48:23 +01:00
CONTINUE_TEXT,
CONTINUE_TEXT_ALIGN,
CONTINUE_TEXT_PLACE,
CONTINUE_FONT_FACE,
CONTINUE_FONT_SIZE,
CONTINUE_FONT_STYLE,
2017-02-07 18:48:23 +01:00
CONTINUE_TEXT_OFFSET,
END_TEXT,
2017-02-07 18:48:23 +01:00
END_TEXT_ALIGN,
END_TEXT_PLACE,
END_HOOK_TYPE,
END_HOOK_HEIGHT,
END_FONT_FACE,
END_FONT_SIZE,
END_FONT_STYLE,
2017-02-07 18:48:23 +01:00
END_TEXT_OFFSET,
2017-01-05 14:53:21 +01:00
2018-07-16 14:35:11 +02:00
POS_ABOVE,
LOCATION_STAVES,
LOCATION_VOICES,
LOCATION_MEASURES,
LOCATION_FRACTIONS,
LOCATION_GRACE,
LOCATION_NOTE,
VOICE,
POSITION,
CLEF_TYPE_CONCERT,
CLEF_TYPE_TRANSPOSING,
KEY,
ACTION, // for Icon
2019-05-06 20:41:21 +02:00
MIN_DISTANCE,
2019-05-31 11:47:18 +02:00
ARPEGGIO_TYPE,
CHORD_LINE_TYPE,
CHORD_LINE_STRAIGHT,
TREMOLO_TYPE,
TREMOLO_PLACEMENT,
2019-05-31 11:47:18 +02:00
2014-05-26 18:18:01 +02:00
END
2012-05-26 14:26:10 +02:00
};
2014-05-26 16:46:41 +02:00
enum class P_TYPE : char {
BOOL,
INT,
REAL,
SPATIUM,
2017-02-07 18:48:23 +01:00
SP_REAL, // real (point) value saved in (score) spatium units
2014-05-26 16:46:41 +02:00
FRACTION,
POINT,
POINT_SP, // point units, value saved in (score) spatium units
2014-05-26 16:46:41 +02:00
POINT_MM,
POINT_SP_MM, // point units, value saved as mm or spatium depending on Element->sizeIsSpatiumDependent()
2014-05-26 16:46:41 +02:00
SIZE,
SIZE_MM,
STRING,
SCALE,
COLOR,
2016-03-02 13:20:19 +01:00
DIRECTION, // enum class Direction
DIRECTION_H, // enum class MScore::DirectionH
ORNAMENT_STYLE, // enum class MScore::OrnamentStyle
TDURATION,
2014-05-26 16:46:41 +02:00
LAYOUT_BREAK,
VALUE_TYPE,
BEAM_MODE,
PLACEMENT,
TEXT_PLACE,
2014-05-26 16:46:41 +02:00
TEMPO,
GROUPS,
SYMID,
INT_LIST,
2015-11-02 11:20:40 +01:00
GLISSANDO_STYLE,
BARLINE_TYPE,
HEAD_TYPE, // enum class Notehead::Type
HEAD_GROUP, // enum class Notehead::Group
2016-08-24 18:08:53 +02:00
ZERO_INT, // displayed with offset +1
2017-01-05 14:53:21 +01:00
FONT,
2017-01-16 20:51:12 +01:00
SUB_STYLE,
ALIGN,
2018-12-22 11:43:23 +01:00
CHANGE_METHOD, // enum class VeloChangeMethod (for single notedynamics)
CHANGE_SPEED, // enum class Dynamic::Speed
CLEF_TYPE, // enum class ClefType
DYNAMIC_TYPE // enum class Dynamic::Type
2012-05-26 14:26:10 +02:00
};
2018-10-26 10:41:07 +02:00
extern QVariant readProperty(Pid type, XmlReader& e);
extern QVariant propertyFromString(Pid type, QString value);
extern QString propertyToString(Pid, QVariant value, bool mscx);
2018-03-27 15:36:00 +02:00
extern P_TYPE propertyType(Pid);
extern const char* propertyName(Pid);
extern bool propertyLink(Pid id);
extern Pid propertyId(const QString& name);
extern Pid propertyId(const QStringRef& name);
2018-09-26 12:58:46 +02:00
extern QString propertyUserName(Pid);
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