Mercurial > hg > svcore
comparison base/Clipboard.cpp @ 340:516819f2b97b
* Add Erase tool and mode
* Add icons for Normalize buttons in property boxes, and for Show Peaks
* Add support for velocity in notes -- not yet reflected in display or
editable in the note edit dialog, but they are imported from MIDI,
played, and exported
* Begin work on making pastes align pasted times (subtler than I thought)
author | Chris Cannam |
---|---|
date | Fri, 23 Nov 2007 16:48:23 +0000 |
parents | 47fd14e29813 |
children | 007b01b971a6 94fc0591ea43 |
comparison
equal
deleted
inserted
replaced
339:ba30f4a3e3be | 340:516819f2b97b |
---|---|
19 m_haveFrame(true), | 19 m_haveFrame(true), |
20 m_frame(frame), | 20 m_frame(frame), |
21 m_haveValue(false), | 21 m_haveValue(false), |
22 m_haveDuration(false), | 22 m_haveDuration(false), |
23 m_haveLabel(true), | 23 m_haveLabel(true), |
24 m_label(label) | 24 m_label(label), |
25 m_haveLevel(false), | |
26 m_level(0.f), | |
27 m_haveReferenceFrame(false), | |
28 m_referenceFrame(frame) | |
25 { | 29 { |
26 } | 30 } |
27 | 31 |
28 Clipboard::Point::Point(long frame, float value, QString label) : | 32 Clipboard::Point::Point(long frame, float value, QString label) : |
29 m_haveFrame(true), | 33 m_haveFrame(true), |
30 m_frame(frame), | 34 m_frame(frame), |
31 m_haveValue(true), | 35 m_haveValue(true), |
32 m_value(value), | 36 m_value(value), |
33 m_haveDuration(false), | 37 m_haveDuration(false), |
34 m_haveLabel(true), | 38 m_haveLabel(true), |
35 m_label(label) | 39 m_label(label), |
40 m_haveLevel(false), | |
41 m_level(0.f), | |
42 m_haveReferenceFrame(false), | |
43 m_referenceFrame(frame) | |
36 { | 44 { |
37 } | 45 } |
38 | 46 |
39 Clipboard::Point::Point(long frame, float value, size_t duration, QString label) : | 47 Clipboard::Point::Point(long frame, float value, size_t duration, QString label) : |
40 m_haveFrame(true), | 48 m_haveFrame(true), |
42 m_haveValue(true), | 50 m_haveValue(true), |
43 m_value(value), | 51 m_value(value), |
44 m_haveDuration(true), | 52 m_haveDuration(true), |
45 m_duration(duration), | 53 m_duration(duration), |
46 m_haveLabel(true), | 54 m_haveLabel(true), |
47 m_label(label) | 55 m_label(label), |
56 m_haveLevel(false), | |
57 m_level(0.f), | |
58 m_haveReferenceFrame(false), | |
59 m_referenceFrame(frame) | |
60 { | |
61 } | |
62 | |
63 Clipboard::Point::Point(long frame, float value, size_t duration, float level, QString label) : | |
64 m_haveFrame(true), | |
65 m_frame(frame), | |
66 m_haveValue(true), | |
67 m_value(value), | |
68 m_haveDuration(true), | |
69 m_duration(duration), | |
70 m_haveLabel(true), | |
71 m_label(label), | |
72 m_haveLevel(true), | |
73 m_level(level), | |
74 m_haveReferenceFrame(false), | |
75 m_referenceFrame(frame) | |
48 { | 76 { |
49 } | 77 } |
50 | 78 |
51 Clipboard::Point::Point(const Point &point) : | 79 Clipboard::Point::Point(const Point &point) : |
52 m_haveFrame(point.m_haveFrame), | 80 m_haveFrame(point.m_haveFrame), |
54 m_haveValue(point.m_haveValue), | 82 m_haveValue(point.m_haveValue), |
55 m_value(point.m_value), | 83 m_value(point.m_value), |
56 m_haveDuration(point.m_haveDuration), | 84 m_haveDuration(point.m_haveDuration), |
57 m_duration(point.m_duration), | 85 m_duration(point.m_duration), |
58 m_haveLabel(point.m_haveLabel), | 86 m_haveLabel(point.m_haveLabel), |
59 m_label(point.m_label) | 87 m_label(point.m_label), |
88 m_haveLevel(point.m_haveLevel), | |
89 m_level(point.m_level), | |
90 m_haveReferenceFrame(point.m_haveReferenceFrame), | |
91 m_referenceFrame(point.m_referenceFrame) | |
60 { | 92 { |
61 } | 93 } |
62 | 94 |
63 Clipboard::Point & | 95 Clipboard::Point & |
64 Clipboard::Point::operator=(const Point &point) | 96 Clipboard::Point::operator=(const Point &point) |
70 m_value = point.m_value; | 102 m_value = point.m_value; |
71 m_haveDuration = point.m_haveDuration; | 103 m_haveDuration = point.m_haveDuration; |
72 m_duration = point.m_duration; | 104 m_duration = point.m_duration; |
73 m_haveLabel = point.m_haveLabel; | 105 m_haveLabel = point.m_haveLabel; |
74 m_label = point.m_label; | 106 m_label = point.m_label; |
107 m_haveLevel = point.m_haveLevel; | |
108 m_level = point.m_level; | |
109 m_haveReferenceFrame = point.m_haveReferenceFrame; | |
110 m_referenceFrame = point.m_referenceFrame; | |
75 return *this; | 111 return *this; |
76 } | 112 } |
77 | 113 |
78 bool | 114 bool |
79 Clipboard::Point::haveFrame() const | 115 Clipboard::Point::haveFrame() const |
121 Clipboard::Point::getLabel() const | 157 Clipboard::Point::getLabel() const |
122 { | 158 { |
123 return m_label; | 159 return m_label; |
124 } | 160 } |
125 | 161 |
162 bool | |
163 Clipboard::Point::haveLevel() const | |
164 { | |
165 return m_haveLevel; | |
166 } | |
167 | |
168 float | |
169 Clipboard::Point::getLevel() const | |
170 { | |
171 return m_level; | |
172 } | |
173 | |
174 bool | |
175 Clipboard::Point::haveReferenceFrame() const | |
176 { | |
177 return m_haveReferenceFrame; | |
178 } | |
179 | |
180 long | |
181 Clipboard::Point::getReferenceFrame() const | |
182 { | |
183 return m_referenceFrame; | |
184 } | |
185 | |
186 void | |
187 Clipboard::Point::setReferenceFrame(long f) | |
188 { | |
189 if (f != m_frame) m_haveReferenceFrame = true; | |
190 m_referenceFrame = f; | |
191 } | |
192 | |
126 Clipboard::Clipboard() { } | 193 Clipboard::Clipboard() { } |
127 Clipboard::~Clipboard() { } | 194 Clipboard::~Clipboard() { } |
128 | 195 |
129 void | 196 void |
130 Clipboard::clear() | 197 Clipboard::clear() |
154 Clipboard::addPoint(const Point &point) | 221 Clipboard::addPoint(const Point &point) |
155 { | 222 { |
156 m_points.push_back(point); | 223 m_points.push_back(point); |
157 } | 224 } |
158 | 225 |
226 bool | |
227 Clipboard::haveReferenceFrames() const | |
228 { | |
229 for (PointList::const_iterator i = m_points.begin(); | |
230 i != m_points.end(); ++i) { | |
231 if (i->haveReferenceFrame()) return true; | |
232 } | |
233 return false; | |
234 } | |
235 |