diff 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
line wrap: on
line diff
--- a/layer/TimeRulerLayer.cpp	Wed Mar 15 18:21:17 2006 +0000
+++ b/layer/TimeRulerLayer.cpp	Thu Mar 16 18:46:00 2006 +0000
@@ -137,8 +137,8 @@
 
     long rectStart = startFrame + (rect.x() - 100) * zoomLevel;
     long rectEnd = startFrame + (rect.x() + rect.width() + 100) * zoomLevel;
-    if (rectStart < startFrame) rectStart = startFrame;
-    if (rectEnd > endFrame) rectEnd = endFrame;
+//    if (rectStart < startFrame) rectStart = startFrame;
+//    if (rectEnd > endFrame) rectEnd = endFrame;
 
 //    std::cerr << "TimeRulerLayer::paint: calling paint.save()" << std::endl;
     paint.save();
@@ -197,6 +197,7 @@
     QRect newClipRect(oldClipRect.x() - 25, oldClipRect.y(),
 		      oldClipRect.width() + 50, oldClipRect.height());
     paint.setClipRect(newClipRect);
+    paint.setClipRect(rect);
 
     QColor greyColour(m_colour);
     if (m_colour == Qt::black) {
@@ -241,22 +242,13 @@
 
 	int tw = metrics.width(text);
 
-	paint.setPen(v->palette().background().color());
+	if (v->getLayer(0) == this) {
+	    // backmost layer, don't worry about outlining the text
+	    paint.drawText(x+2 - tw/2, y, text);
+	} else {
+	    v->drawVisibleText(paint, x+2 - tw/2, y, text, View::OutlinedText);
+	}
 
-	//!!! simple drawing function for this please
-	//!!! and need getContrastingColour() in widget, or use the
-	//palette properly -- get the base class able to draw text
-	//using the proper colour (or this technique) automatically
-	for (int dx = -1; dx <= 1; ++dx) {
-	    for (int dy = -1; dy <= 1; ++dy) {
-		if ((dx && dy) || !(dx || dy)) continue;
-		paint.drawText(x + 2 - tw / 2 + dx, y + dy, text);
-	    }
-	}
-	
-	paint.setPen(m_colour);
-	paint.drawText(x + 2 - tw / 2, y, text);
-		
 	paint.setPen(greyColour);
 
 	for (int i = 1; i < ticks; ++i) {