Mercurial > hg > svgui
comparison layer/TimeRulerLayer.cpp @ 55:128ebfeeebee
* Add Insert Instant function in main window
* Ensure selections and window geometry are saved in session file
* Add wait cursor on session file save
* Various improvements to display of texts in pane (clearer readability)
* Use commands for setting properties on layers and panes
(still need to batch up multiple sets on the same property)
* Fix failure of spectrogram to refresh when initial part became visible
* Some fixes & paint optimisations in View &c
* Make curve mode for time value layers work properly when resolution == 1
* Some vague improvements for time value layer vertical scale
author | Chris Cannam |
---|---|
date | Thu, 16 Mar 2006 18:46:00 +0000 |
parents | ad214997dddb |
children | 01ab51f72e84 |
comparison
equal
deleted
inserted
replaced
54:8dae7f6732c1 | 55:128ebfeeebee |
---|---|
135 | 135 |
136 int zoomLevel = v->getZoomLevel(); | 136 int zoomLevel = v->getZoomLevel(); |
137 | 137 |
138 long rectStart = startFrame + (rect.x() - 100) * zoomLevel; | 138 long rectStart = startFrame + (rect.x() - 100) * zoomLevel; |
139 long rectEnd = startFrame + (rect.x() + rect.width() + 100) * zoomLevel; | 139 long rectEnd = startFrame + (rect.x() + rect.width() + 100) * zoomLevel; |
140 if (rectStart < startFrame) rectStart = startFrame; | 140 // if (rectStart < startFrame) rectStart = startFrame; |
141 if (rectEnd > endFrame) rectEnd = endFrame; | 141 // if (rectEnd > endFrame) rectEnd = endFrame; |
142 | 142 |
143 // std::cerr << "TimeRulerLayer::paint: calling paint.save()" << std::endl; | 143 // std::cerr << "TimeRulerLayer::paint: calling paint.save()" << std::endl; |
144 paint.save(); | 144 paint.save(); |
145 //!!! paint.setClipRect(v->rect()); | 145 //!!! paint.setClipRect(v->rect()); |
146 | 146 |
195 | 195 |
196 QRect oldClipRect = rect; | 196 QRect oldClipRect = rect; |
197 QRect newClipRect(oldClipRect.x() - 25, oldClipRect.y(), | 197 QRect newClipRect(oldClipRect.x() - 25, oldClipRect.y(), |
198 oldClipRect.width() + 50, oldClipRect.height()); | 198 oldClipRect.width() + 50, oldClipRect.height()); |
199 paint.setClipRect(newClipRect); | 199 paint.setClipRect(newClipRect); |
200 paint.setClipRect(rect); | |
200 | 201 |
201 QColor greyColour(m_colour); | 202 QColor greyColour(m_colour); |
202 if (m_colour == Qt::black) { | 203 if (m_colour == Qt::black) { |
203 greyColour = QColor(200,200,200); | 204 greyColour = QColor(200,200,200); |
204 } else { | 205 } else { |
239 y = v->height() - metrics.height() + metrics.ascent() - 6; | 240 y = v->height() - metrics.height() + metrics.ascent() - 6; |
240 } | 241 } |
241 | 242 |
242 int tw = metrics.width(text); | 243 int tw = metrics.width(text); |
243 | 244 |
244 paint.setPen(v->palette().background().color()); | 245 if (v->getLayer(0) == this) { |
245 | 246 // backmost layer, don't worry about outlining the text |
246 //!!! simple drawing function for this please | 247 paint.drawText(x+2 - tw/2, y, text); |
247 //!!! and need getContrastingColour() in widget, or use the | 248 } else { |
248 //palette properly -- get the base class able to draw text | 249 v->drawVisibleText(paint, x+2 - tw/2, y, text, View::OutlinedText); |
249 //using the proper colour (or this technique) automatically | 250 } |
250 for (int dx = -1; dx <= 1; ++dx) { | 251 |
251 for (int dy = -1; dy <= 1; ++dy) { | |
252 if ((dx && dy) || !(dx || dy)) continue; | |
253 paint.drawText(x + 2 - tw / 2 + dx, y + dy, text); | |
254 } | |
255 } | |
256 | |
257 paint.setPen(m_colour); | |
258 paint.drawText(x + 2 - tw / 2, y, text); | |
259 | |
260 paint.setPen(greyColour); | 252 paint.setPen(greyColour); |
261 | 253 |
262 for (int i = 1; i < ticks; ++i) { | 254 for (int i = 1; i < ticks; ++i) { |
263 rt = rt + (incRt / ticks); | 255 rt = rt + (incRt / ticks); |
264 frame = RealTime::realTime2Frame(rt, sampleRate); | 256 frame = RealTime::realTime2Frame(rt, sampleRate); |