comparison view/View.cpp @ 183:5f86ae638b04

* Omit translucent blue fill for selection rectangles that are superimposed over layers that use colours for meaningful purposes such as the spectrogram (CHARM change request)
author Chris Cannam
date Fri, 24 Nov 2006 16:56:15 +0000
parents 29f01de27db4
children 8dd247c4c5f1
comparison
equal deleted inserted replaced
182:42118892f428 183:5f86ae638b04
1023 haveCandidate = true; 1023 haveCandidate = true;
1024 } 1024 }
1025 } 1025 }
1026 1026
1027 return candidate; 1027 return candidate;
1028 }
1029
1030 bool
1031 View::areLayerColoursSignificant() const
1032 {
1033 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
1034 if ((*i)->isLayerColourSignificant()) return true;
1035 if ((*i)->isLayerOpaque()) break;
1036 }
1037 return false;
1028 } 1038 }
1029 1039
1030 void 1040 void
1031 View::zoom(bool in) 1041 View::zoom(bool in)
1032 { 1042 {
1394 selections.insert(inProgressSelection); 1404 selections.insert(inProgressSelection);
1395 } 1405 }
1396 } 1406 }
1397 1407
1398 paint.save(); 1408 paint.save();
1399 paint.setBrush(QColor(150, 150, 255, 80)); 1409
1410 bool translucent = !areLayerColoursSignificant();
1411
1412 if (translucent) {
1413 paint.setBrush(QColor(150, 150, 255, 80));
1414 } else {
1415 paint.setBrush(Qt::NoBrush);
1416 }
1400 1417
1401 int sampleRate = getModelsSampleRate(); 1418 int sampleRate = getModelsSampleRate();
1402 1419
1403 QPoint localPos; 1420 QPoint localPos;
1404 long illuminateFrame = -1; 1421 long illuminateFrame = -1;
1424 1441
1425 bool illuminateThis = 1442 bool illuminateThis =
1426 (illuminateFrame >= 0 && i->contains(illuminateFrame)); 1443 (illuminateFrame >= 0 && i->contains(illuminateFrame));
1427 1444
1428 paint.setPen(QColor(150, 150, 255)); 1445 paint.setPen(QColor(150, 150, 255));
1429 paint.drawRect(p0, -1, p1 - p0, height() + 1); 1446
1447 if (translucent && shouldLabelSelections()) {
1448 paint.drawRect(p0, -1, p1 - p0, height() + 1);
1449 } else {
1450 // Make the top & bottom lines of the box visible if we
1451 // are lacking some of the other visual cues. There's no
1452 // particular logic to this, it's just a question of what
1453 // I happen to think looks nice.
1454 paint.drawRect(p0, 0, p1 - p0, height() - 1);
1455 }
1430 1456
1431 if (illuminateThis) { 1457 if (illuminateThis) {
1432 paint.save(); 1458 paint.save();
1433 if (hasLightBackground()) { 1459 if (hasLightBackground()) {
1434 paint.setPen(QPen(Qt::black, 2)); 1460 paint.setPen(QPen(Qt::black, 2));