Mercurial > hg > svgui
comparison widgets/AudioDial.cpp @ 1476:c268fe2ad597 by-id
Couple more updates
author | Chris Cannam |
---|---|
date | Tue, 02 Jul 2019 15:38:37 +0100 |
parents | 089afbbe1253 |
children | bdf284b29722 |
comparison
equal
deleted
inserted
replaced
1475:84c4ddb38415 | 1476:c268fe2ad597 |
---|---|
130 int ns = notchSize(); | 130 int ns = notchSize(); |
131 int numTicks = 1 + (maximum() + ns - minimum()) / ns; | 131 int numTicks = 1 + (maximum() + ns - minimum()) / ns; |
132 | 132 |
133 QColor knobColor(m_knobColor); | 133 QColor knobColor(m_knobColor); |
134 if (knobColor == Qt::black) { | 134 if (knobColor == Qt::black) { |
135 knobColor = palette().window().color().light(150); | 135 knobColor = palette().window().color().lighter(150); |
136 } | 136 } |
137 bool knobIsDark = | 137 bool knobIsDark = |
138 (knobColor.red() + knobColor.green() + knobColor.blue() <= 384); | 138 (knobColor.red() + knobColor.green() + knobColor.blue() <= 384); |
139 | 139 |
140 QColor meterColor(m_meterColor); | 140 QColor meterColor(m_meterColor); |
181 pen.setWidth(3 * scale); | 181 pen.setWidth(3 * scale); |
182 int pos = indent-1 + (width-2*indent) / 20; | 182 int pos = indent-1 + (width-2*indent) / 20; |
183 int darkWidth = (width-2*indent) * 3 / 4; | 183 int darkWidth = (width-2*indent) * 3 / 4; |
184 while (darkWidth) { | 184 while (darkWidth) { |
185 if (knobIsDark) { | 185 if (knobIsDark) { |
186 c = c.dark(102); | 186 c = c.darker(102); |
187 } else { | 187 } else { |
188 c = c.light(102); | 188 c = c.lighter(102); |
189 } | 189 } |
190 pen.setColor(c); | 190 pen.setColor(c); |
191 paint.setPen(pen); | 191 paint.setPen(pen); |
192 paint.drawEllipse(pos, pos, darkWidth, darkWidth); | 192 paint.drawEllipse(pos, pos, darkWidth, darkWidth); |
193 if (!--darkWidth) break; | 193 if (!--darkWidth) break; |
236 | 236 |
237 // Knob shadow... | 237 // Knob shadow... |
238 | 238 |
239 int shadowAngle = -720; | 239 int shadowAngle = -720; |
240 if (knobIsDark) { | 240 if (knobIsDark) { |
241 c = knobColor.light(); | 241 c = knobColor.lighter(); |
242 } else { | 242 } else { |
243 c = knobColor.dark(); | 243 c = knobColor.darker(); |
244 } | 244 } |
245 for (int arc = 120; arc < 2880; arc += 240) { | 245 for (int arc = 120; arc < 2880; arc += 240) { |
246 pen.setColor(c); | 246 pen.setColor(c); |
247 paint.setPen(pen); | 247 paint.setPen(pen); |
248 paint.drawArc(indent, indent, | 248 paint.drawArc(indent, indent, |
249 width-2*indent, width-2*indent, shadowAngle + arc, 240); | 249 width-2*indent, width-2*indent, shadowAngle + arc, 240); |
250 paint.drawArc(indent, indent, | 250 paint.drawArc(indent, indent, |
251 width-2*indent, width-2*indent, shadowAngle - arc, 240); | 251 width-2*indent, width-2*indent, shadowAngle - arc, 240); |
252 if (knobIsDark) { | 252 if (knobIsDark) { |
253 c = c.dark(110); | 253 c = c.darker(110); |
254 } else { | 254 } else { |
255 c = c.light(110); | 255 c = c.lighter(110); |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 // Scale shadow, omitting the bottom part... | 259 // Scale shadow, omitting the bottom part... |
260 | 260 |
264 pen.setColor(c); | 264 pen.setColor(c); |
265 paint.setPen(pen); | 265 paint.setPen(pen); |
266 int arc = i * 240 + 120; | 266 int arc = i * 240 + 120; |
267 paint.drawArc(scale/2, scale/2, | 267 paint.drawArc(scale/2, scale/2, |
268 width-scale, width-scale, shadowAngle + arc, 240); | 268 width-scale, width-scale, shadowAngle + arc, 240); |
269 c = c.light(110); | 269 c = c.lighter(110); |
270 } | 270 } |
271 c = palette().shadow().color(); | 271 c = palette().shadow().color(); |
272 for (int i = 0; i < 12; ++i) { | 272 for (int i = 0; i < 12; ++i) { |
273 pen.setColor(c); | 273 pen.setColor(c); |
274 paint.setPen(pen); | 274 paint.setPen(pen); |
275 int arc = i * 240 + 120; | 275 int arc = i * 240 + 120; |
276 paint.drawArc(scale/2, scale/2, | 276 paint.drawArc(scale/2, scale/2, |
277 width-scale, width-scale, shadowAngle - arc, 240); | 277 width-scale, width-scale, shadowAngle - arc, 240); |
278 c = c.light(110); | 278 c = c.lighter(110); |
279 } | 279 } |
280 | 280 |
281 // Scale ends... | 281 // Scale ends... |
282 | 282 |
283 if (knobIsDark) { | 283 if (knobIsDark) { |
308 double y = hyp + len * cos(angle); | 308 double y = hyp + len * cos(angle); |
309 | 309 |
310 c = notchColor; | 310 c = notchColor; |
311 if (isEnabled()) { | 311 if (isEnabled()) { |
312 if (knobIsDark) { | 312 if (knobIsDark) { |
313 c = c.light(130); | 313 c = c.lighter(130); |
314 } else { | 314 } else { |
315 c = c.dark(130); | 315 c = c.darker(130); |
316 } | 316 } |
317 } | 317 } |
318 pen.setColor(c); | 318 pen.setColor(c); |
319 pen.setWidth(scale * 2); | 319 pen.setWidth(scale * 2); |
320 paint.setPen(pen); | 320 paint.setPen(pen); |