Mercurial > hg > svgui
comparison view/Pane.cpp @ 1401:28075cc658c9
Scale pen for retina display on macOS as well as for hidpi display elsewhere
author | Chris Cannam |
---|---|
date | Thu, 15 Nov 2018 14:04:32 +0000 |
parents | 9ea551137329 |
children | b0eeec95ab5b |
comparison
equal
deleted
inserted
replaced
1400:decb7741d036 | 1401:28075cc658c9 |
---|---|
686 QColor c = QColor(0, 0, 0); | 686 QColor c = QColor(0, 0, 0); |
687 if (!hasLightBackground()) { | 687 if (!hasLightBackground()) { |
688 c = QColor(240, 240, 240); | 688 c = QColor(240, 240, 240); |
689 } | 689 } |
690 | 690 |
691 paint.setPen(PaintAssistant::scalePen(c)); | 691 paint.setPen(scalePen(c)); |
692 int x = width() / 2; | 692 int x = width() / 2; |
693 | 693 |
694 if (!omitLine) { | 694 if (!omitLine) { |
695 paint.drawLine(x, 0, x, height() - 1); | 695 paint.drawLine(x, 0, x, height() - 1); |
696 paint.drawLine(x-1, 1, x+1, 1); | 696 paint.drawLine(x-1, 1, x+1, 1); |
1171 { | 1171 { |
1172 closeToLeftEdge = closeToRightEdge = false; | 1172 closeToLeftEdge = closeToRightEdge = false; |
1173 | 1173 |
1174 if (!m_manager) return Selection(); | 1174 if (!m_manager) return Selection(); |
1175 | 1175 |
1176 sv_frame_t testFrame = getFrameForX(x - ViewManager::scalePixelSize(5)); | 1176 sv_frame_t testFrame = getFrameForX(x - scaleSize(5)); |
1177 if (testFrame < 0) { | 1177 if (testFrame < 0) { |
1178 testFrame = getFrameForX(x); | 1178 testFrame = getFrameForX(x); |
1179 if (testFrame < 0) return Selection(); | 1179 if (testFrame < 0) return Selection(); |
1180 } | 1180 } |
1181 | 1181 |
1183 if (selection.isEmpty()) return selection; | 1183 if (selection.isEmpty()) return selection; |
1184 | 1184 |
1185 int lx = getXForFrame(selection.getStartFrame()); | 1185 int lx = getXForFrame(selection.getStartFrame()); |
1186 int rx = getXForFrame(selection.getEndFrame()); | 1186 int rx = getXForFrame(selection.getEndFrame()); |
1187 | 1187 |
1188 int fuzz = ViewManager::scalePixelSize(2); | 1188 int fuzz = scaleSize(2); |
1189 if (x < lx - fuzz || x > rx + fuzz) return Selection(); | 1189 if (x < lx - fuzz || x > rx + fuzz) return Selection(); |
1190 | 1190 |
1191 int width = rx - lx; | 1191 int width = rx - lx; |
1192 fuzz = ViewManager::scalePixelSize(3); | 1192 fuzz = scaleSize(3); |
1193 if (width < 12) fuzz = width / 4; | 1193 if (width < 12) fuzz = width / 4; |
1194 if (fuzz < ViewManager::scalePixelSize(1)) { | 1194 if (fuzz < scaleSize(1)) { |
1195 fuzz = ViewManager::scalePixelSize(1); | 1195 fuzz = scaleSize(1); |
1196 } | 1196 } |
1197 | 1197 |
1198 if (x < lx + fuzz) closeToLeftEdge = true; | 1198 if (x < lx + fuzz) closeToLeftEdge = true; |
1199 if (x > rx - fuzz) closeToRightEdge = true; | 1199 if (x > rx - fuzz) closeToRightEdge = true; |
1200 | 1200 |