comparison layer/TimeValueLayer.cpp @ 1229:491dd600570c

Scale pens
author Chris Cannam
date Thu, 26 Jan 2017 21:17:36 +0000
parents 69ff93e0c624
children a34a2a25907c
comparison
equal deleted inserted replaced
1228:dc6457ac4d07 1229:491dd600570c
1044 } 1044 }
1045 1045
1046 // cout << "frame = " << p.frame << ", x = " << x << ", haveNext = " << haveNext 1046 // cout << "frame = " << p.frame << ", x = " << x << ", haveNext = " << haveNext
1047 // << ", nx = " << nx << endl; 1047 // << ", nx = " << nx << endl;
1048 1048
1049 QPen pen(getBaseQColor());
1050 QBrush brush(brushColour);
1051
1049 if (m_plotStyle == PlotDiscreteCurves) { 1052 if (m_plotStyle == PlotDiscreteCurves) {
1050 paint.setPen(QPen(getBaseQColor(), 3)); 1053 pen = QPen(getBaseQColor(), 3);
1051 paint.setBrush(Qt::NoBrush); 1054 brush = QBrush(Qt::NoBrush);
1052 } else if (m_plotStyle == PlotSegmentation) { 1055 } else if (m_plotStyle == PlotSegmentation) {
1053 paint.setPen(getForegroundQColor(v)); 1056 pen = QPen(getForegroundQColor(v));
1054 paint.setBrush(getColourForValue(v, value)); 1057 brush = QBrush(getColourForValue(v, value));
1055 } else if (m_plotStyle == PlotLines || 1058 } else if (m_plotStyle == PlotLines ||
1056 m_plotStyle == PlotCurve) { 1059 m_plotStyle == PlotCurve) {
1057 paint.setPen(getBaseQColor()); 1060 brush = QBrush(Qt::NoBrush);
1058 paint.setBrush(Qt::NoBrush); 1061 }
1059 } else { 1062
1060 paint.setPen(getBaseQColor()); 1063 paint.setPen(PaintAssistant::scalePen(pen));
1061 paint.setBrush(brushColour); 1064 paint.setBrush(brush);
1062 } 1065
1063
1064 if (m_plotStyle == PlotStems) { 1066 if (m_plotStyle == PlotStems) {
1065 /*
1066 paint.setPen(brushColour);
1067 if (y < origin - 1) {
1068 paint.drawRect(x + w/2, y + 1, 1, origin - y);
1069 } else if (y > origin + 1) {
1070 paint.drawRect(x + w/2, origin, 1, y - origin - 1);
1071 }
1072 */
1073 paint.setPen(getBaseQColor());
1074 if (y < origin - 1) { 1067 if (y < origin - 1) {
1075 paint.drawLine(x + w/2, y + 1, x + w/2, origin); 1068 paint.drawLine(x + w/2, y + 1, x + w/2, origin);
1076 } else if (y > origin + 1) { 1069 } else if (y > origin + 1) {
1077 paint.drawLine(x + w/2, origin, x + w/2, y - 1); 1070 paint.drawLine(x + w/2, origin, x + w/2, y - 1);
1078 } 1071 }
1096 m_plotStyle != PlotCurve && 1089 m_plotStyle != PlotCurve &&
1097 m_plotStyle != PlotDiscreteCurves && 1090 m_plotStyle != PlotDiscreteCurves &&
1098 m_plotStyle != PlotSegmentation) { 1091 m_plotStyle != PlotSegmentation) {
1099 if (illuminate) { 1092 if (illuminate) {
1100 paint.save(); 1093 paint.save();
1101 paint.setPen(getForegroundQColor(v)); 1094 paint.setPen(PaintAssistant::scalePen(getForegroundQColor(v)));
1102 paint.setBrush(getForegroundQColor(v)); 1095 paint.setBrush(getForegroundQColor(v));
1103 } 1096 }
1104 if (m_plotStyle != PlotStems || 1097 if (m_plotStyle != PlotStems ||
1105 w > 1) { 1098 w > 1) {
1106 paint.drawRect(x, y - 1, w, 2); 1099 paint.drawRect(x, y - 1, w, 2);
1118 if (haveNext) { 1111 if (haveNext) {
1119 1112
1120 if (m_plotStyle == PlotConnectedPoints) { 1113 if (m_plotStyle == PlotConnectedPoints) {
1121 1114
1122 paint.save(); 1115 paint.save();
1123 paint.setPen(brushColour); 1116 paint.setPen(PaintAssistant::scalePen(brushColour));
1124 paint.drawLine(x + w, y, nx, ny); 1117 paint.drawLine(x + w, y, nx, ny);
1125 paint.restore(); 1118 paint.restore();
1126 1119
1127 } else if (m_plotStyle == PlotLines) { 1120 } else if (m_plotStyle == PlotLines) {
1128 1121
1177 cerr << "drawing rect" << endl; 1170 cerr << "drawing rect" << endl;
1178 #endif 1171 #endif
1179 1172
1180 if (nx <= x) continue; 1173 if (nx <= x) continue;
1181 1174
1182 paint.setPen(QPen(getForegroundQColor(v), 2)); 1175 paint.setPen(PaintAssistant::scalePen(QPen(getForegroundQColor(v), 2)));
1183 1176
1184 if (!illuminate) { 1177 if (!illuminate) {
1185 if (!m_drawSegmentDivisions || 1178 if (!m_drawSegmentDivisions ||
1186 nx < x + 5 || 1179 nx < x + 5 ||
1187 x >= v->getPaintWidth() - 1) { 1180 x >= v->getPaintWidth() - 1) {