Mercurial > hg > svgui
comparison widgets/Pane.cpp @ 25:dcdb21b62dbb
* Refactor sparse models. Previously the 1D and time-value models duplicated
a lot of code; now there is a base class (SparseModel) templated on the
stored point type, and the subclasses define point types with the necessary
characteristics.
* Add NoteModel, a new SparseModel subclass.
* Reorganise local feature description display. Instead of asking the layer
to draw its own, just query it for a textual description and draw that in
Pane. Greatly simplifies this part of the layer code.
* Add local feature descriptions to colour 3D plot and waveform layers.
* Add pitch in MIDI-pitch-and-cents to spectrogram layer.
* Give AudioGenerator its own mutex to shorten lock times in CallbackPlaySource.
* Minor adjustments to layers menu &c
author | Chris Cannam |
---|---|
date | Thu, 02 Feb 2006 16:10:19 +0000 |
parents | ca57f70b0e48 |
children | 38fe0ea9e46e |
comparison
equal
deleted
inserted
replaced
24:6b794a2af3d9 | 25:dcdb21b62dbb |
---|---|
111 | 111 |
112 paint.restore(); | 112 paint.restore(); |
113 } | 113 } |
114 | 114 |
115 if (m_identifyFeatures) { | 115 if (m_identifyFeatures) { |
116 | |
117 QPoint pos = m_identifyPoint; | |
118 QString desc = (*vi)->getFeatureDescription(pos); | |
119 | |
120 if (desc != "") { | |
121 | |
122 paint.save(); | |
123 | |
124 int tabStop = | |
125 paint.fontMetrics().width(tr("Some lengthy prefix:")); | |
126 | |
127 QRect boundingRect = | |
128 paint.fontMetrics().boundingRect | |
129 (rect(), | |
130 Qt::AlignRight | Qt::AlignTop | Qt::TextExpandTabs, | |
131 desc, tabStop); | |
132 | |
133 if (hasLightBackground()) { | |
134 paint.setPen(Qt::NoPen); | |
135 paint.setBrush(QColor(250, 250, 250, 200)); | |
136 } else { | |
137 paint.setPen(Qt::NoPen); | |
138 paint.setBrush(QColor(50, 50, 50, 200)); | |
139 } | |
140 | |
141 int extra = paint.fontMetrics().descent(); | |
142 paint.drawRect(width() - boundingRect.width() - 10 - extra, | |
143 10 - extra, | |
144 boundingRect.width() + 2 * extra, | |
145 boundingRect.height() + extra); | |
146 | |
147 if (hasLightBackground()) { | |
148 paint.setPen(QColor(150, 20, 0)); | |
149 } else { | |
150 paint.setPen(QColor(255, 150, 100)); | |
151 } | |
152 | |
153 QTextOption option; | |
154 option.setWrapMode(QTextOption::NoWrap); | |
155 option.setAlignment(Qt::AlignRight | Qt::AlignTop); | |
156 option.setTabStop(tabStop); | |
157 paint.drawText(QRectF(width() - boundingRect.width() - 10, 10, | |
158 boundingRect.width(), | |
159 boundingRect.height()), | |
160 desc, | |
161 option); | |
162 | |
163 paint.restore(); | |
164 } | |
165 | |
166 /*!!! | |
116 QRect descRect = (*vi)->getFeatureDescriptionRect(paint, | 167 QRect descRect = (*vi)->getFeatureDescriptionRect(paint, |
117 m_identifyPoint); | 168 m_identifyPoint); |
118 if (descRect.width() > 0 && descRect.height() > 0 && | 169 if (descRect.width() > 0 && descRect.height() > 0 && |
119 r.left() + r.width() >= width() - descRect.width() && | 170 r.left() + r.width() >= width() - descRect.width() && |
120 r.top() < descRect.height()) { | 171 r.top() < descRect.height()) { |
135 paint.setBrush(Qt::NoBrush); | 186 paint.setBrush(Qt::NoBrush); |
136 (*vi)->paintLocalFeatureDescription(paint, rect, m_identifyPoint); | 187 (*vi)->paintLocalFeatureDescription(paint, rect, m_identifyPoint); |
137 | 188 |
138 paint.restore(); | 189 paint.restore(); |
139 } | 190 } |
191 | |
192 */ | |
140 } | 193 } |
141 | 194 |
142 break; | 195 break; |
143 } | 196 } |
144 | 197 |