comparison layer/TimeRulerLayer.cpp @ 216:34bbbcb3c01f sv1-1.0pre1

* Make getPropertyRangeAndValue return the default separately from the current value. Previously some contexts were incorrectly treating the current value as a default.
author Chris Cannam
date Fri, 02 Mar 2007 14:00:12 +0000
parents 6969f21da18a
children 28c8e8e3c537
comparison
equal deleted inserted replaced
215:d2334a77db73 216:34bbbcb3c01f
72 return ValueProperty; 72 return ValueProperty;
73 } 73 }
74 74
75 int 75 int
76 TimeRulerLayer::getPropertyRangeAndValue(const PropertyName &name, 76 TimeRulerLayer::getPropertyRangeAndValue(const PropertyName &name,
77 int *min, int *max) const 77 int *min, int *max, int *deflt) const
78 { 78 {
79 int deft = 0; 79 int val = 0;
80 80
81 if (name == "Colour") { 81 if (name == "Colour") {
82 82
83 if (min) *min = 0; 83 if (min) *min = 0;
84 if (max) *max = 5; 84 if (max) *max = 5;
85 85 if (deflt) *deflt = 0;
86 if (m_colour == Qt::black) deft = 0; 86
87 else if (m_colour == Qt::darkRed) deft = 1; 87 if (m_colour == Qt::black) val = 0;
88 else if (m_colour == Qt::darkBlue) deft = 2; 88 else if (m_colour == Qt::darkRed) val = 1;
89 else if (m_colour == Qt::darkGreen) deft = 3; 89 else if (m_colour == Qt::darkBlue) val = 2;
90 else if (m_colour == QColor(200, 50, 255)) deft = 4; 90 else if (m_colour == Qt::darkGreen) val = 3;
91 else if (m_colour == QColor(255, 150, 50)) deft = 5; 91 else if (m_colour == QColor(200, 50, 255)) val = 4;
92 else if (m_colour == QColor(255, 150, 50)) val = 5;
92 93
93 } else { 94 } else {
94 95
95 deft = Layer::getPropertyRangeAndValue(name, min, max); 96 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
96 } 97 }
97 98
98 return deft; 99 return val;
99 } 100 }
100 101
101 QString 102 QString
102 TimeRulerLayer::getPropertyValueLabel(const PropertyName &name, 103 TimeRulerLayer::getPropertyValueLabel(const PropertyName &name,
103 int value) const 104 int value) const