comparison layer/TimeValueLayer.cpp @ 741:56ba2b03508e tonioni

Introduce a GlobalOverlays mode that shows general surrounding information but less local stuff
author Chris Cannam
date Thu, 06 Mar 2014 15:16:25 +0000
parents 1640a7c753cc
children b6dc57688c72
comparison
equal deleted inserted replaced
740:a31c8ee2e17e 741:56ba2b03508e
1168 } 1168 }
1169 1169
1170 paint.drawRect(x, -1, nx - x, v->height() + 1); 1170 paint.drawRect(x, -1, nx - x, v->height() + 1);
1171 } 1171 }
1172 1172
1173 QString label = p.label; 1173 if (v->shouldShowFeatureLabels()) {
1174 bool italic = false; 1174
1175 1175 QString label = p.label;
1176 if (label == "" && 1176 bool italic = false;
1177 (m_plotStyle == PlotPoints || 1177
1178 m_plotStyle == PlotSegmentation || 1178 if (label == "" &&
1179 m_plotStyle == PlotConnectedPoints)) { 1179 (m_plotStyle == PlotPoints ||
1180 char lc[20]; 1180 m_plotStyle == PlotSegmentation ||
1181 snprintf(lc, 20, "%.3g", p.value); 1181 m_plotStyle == PlotConnectedPoints)) {
1182 label = lc; 1182 char lc[20];
1183 italic = true; 1183 snprintf(lc, 20, "%.3g", p.value);
1184 } 1184 label = lc;
1185 1185 italic = true;
1186 if (label != "") { 1186 }
1187 // Quick test for 20px before we do the slower test using metrics 1187
1188 bool haveRoom = (nx > x + 20); 1188 if (label != "") {
1189 haveRoom = (haveRoom && 1189 // Quick test for 20px before we do the slower test using metrics
1190 (nx > x + 6 + paint.fontMetrics().width(label))); 1190 bool haveRoom = (nx > x + 20);
1191 if (haveRoom || 1191 haveRoom = (haveRoom &&
1192 (!haveNext && 1192 (nx > x + 6 + paint.fontMetrics().width(label)));
1193 (pointCount == 0 || !italic))) { 1193 if (haveRoom ||
1194 v->drawVisibleText(paint, x + 5, textY, label, 1194 (!haveNext &&
1195 italic ? 1195 (pointCount == 0 || !italic))) {
1196 View::OutlinedItalicText : 1196 v->drawVisibleText(paint, x + 5, textY, label,
1197 View::OutlinedText); 1197 italic ?
1198 } 1198 View::OutlinedItalicText :
1199 } 1199 View::OutlinedText);
1200 }
1201 }
1202 }
1200 1203
1201 prevFrame = p.frame; 1204 prevFrame = p.frame;
1202 ++pointCount; 1205 ++pointCount;
1203 } 1206 }
1204 1207