summaryrefslogtreecommitdiffstats
path: root/src/base/BaseProperties.cpp
blob: adff5195f77bd850c886db750bef919951720b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
    Rosegarden
    A sequencer and musical notation editor.

    This program is Copyright 2000-2008
        Guillaume Laurent   <glaurent@telegraph-road.org>,
        Chris Cannam        <cannam@all-day-breakfast.com>,
        Richard Bown        <bownie@bownie.com>

    The moral right of the authors to claim authorship of this work
    has been asserted.

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
    License, or (at your option) any later version.  See the file
    COPYING included with this distribution for more information.
*/

#include "BaseProperties.h"
#include <vector>

#if (__GNUC__ < 3)
#include <strstream>
#define stringstream strstream
#else
#include <sstream>
#endif

namespace Rosegarden
{

namespace BaseProperties
{

// Some of the most basic property names are defined in individual
// classes in NotationTypes.h -- those are the ones that are used to
// store the value of a clef/key/timesig event, whereas things like
// notes have their values calculated from the duration property.

// We mostly define persistent properties with lower-case names and
// non-persistent ones with mixed-case.  That's just because lower-
// case looks nicer in XML, whereas mixed-case is friendlier for the
// sorts of long names sometimes found in cached calculations.

const PropertyName PITCH		= "pitch";
const PropertyName VELOCITY		= "velocity";
const PropertyName ACCIDENTAL		= "accidental";

const PropertyName NOTE_TYPE            = "notetype";
const PropertyName NOTE_DOTS            = "notedots";

const PropertyName MARK_COUNT		= "marks";

PropertyName getMarkPropertyName(int markNo)
{
    static std::vector<PropertyName> firstFive;

    if (firstFive.size() == 0) {
	firstFive.push_back(PropertyName("mark1"));
	firstFive.push_back(PropertyName("mark2"));
	firstFive.push_back(PropertyName("mark3"));
	firstFive.push_back(PropertyName("mark4"));
	firstFive.push_back(PropertyName("mark5"));
    }

    if (markNo < 5) return firstFive[markNo];

    // This is slower than it looks, because it means we need to do
    // the PropertyName interning process for each string -- hence the
    // firstFive cache

    std::stringstream markPropertyName;

#if (__GNUC__ < 3)
    markPropertyName << "mark" << (markNo + 1) << std::ends;
#else
    markPropertyName << "mark" << (markNo + 1);
#endif

    return markPropertyName.str();
}

const PropertyName TIED_BACKWARD	= "tiedback";
const PropertyName TIED_FORWARD		= "tiedforward";
const PropertyName TIE_IS_ABOVE		= "tieabove";

// capitalised for back-compatibility (used to be in NotationProperties)
const PropertyName HEIGHT_ON_STAFF      = "HeightOnStaff";
const PropertyName NOTE_STYLE		= "NoteStyle";
const PropertyName BEAMED		= "Beamed";

const PropertyName BEAMED_GROUP_ID               = "groupid";
const PropertyName BEAMED_GROUP_TYPE		 = "grouptype";

const PropertyName BEAMED_GROUP_TUPLET_BASE	 = "tupletbase";
const PropertyName BEAMED_GROUP_TUPLED_COUNT	 = "tupledcount";
const PropertyName BEAMED_GROUP_UNTUPLED_COUNT	 = "untupledcount";

// persistent, but mixed-case anyway
const PropertyName IS_GRACE_NOTE                 = "IsGraceNote";

// obsolete
const PropertyName HAS_GRACE_NOTES               = "HasGraceNotes";

// non-persistent
const PropertyName MAY_HAVE_GRACE_NOTES          = "MayHaveGraceNotes";

const std::string GROUP_TYPE_BEAMED		 = "beamed";
const std::string GROUP_TYPE_TUPLED		 = "tupled";
const std::string GROUP_TYPE_GRACE		 = "grace";

const PropertyName TRIGGER_SEGMENT_ID            = "triggersegmentid";
const PropertyName TRIGGER_SEGMENT_RETUNE        = "triggersegmentretune";
const PropertyName TRIGGER_SEGMENT_ADJUST_TIMES  = "triggersegmentadjusttimes";

const std::string TRIGGER_SEGMENT_ADJUST_NONE = "none";
const std::string TRIGGER_SEGMENT_ADJUST_SQUISH = "squish";
const std::string TRIGGER_SEGMENT_ADJUST_SYNC_START = "syncstart";
const std::string TRIGGER_SEGMENT_ADJUST_SYNC_END = "syncend";

const PropertyName RECORDED_CHANNEL		 = "recordedchannel";
const PropertyName RECORDED_PORT		 = "recordedport";

const PropertyName DISPLACED_X                   = "displacedx";
const PropertyName DISPLACED_Y                   = "displacedy";

const PropertyName INVISIBLE                     = "invisible";

}

}