comparison layer/TimeInstantLayer.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
84 return ValueProperty; 84 return ValueProperty;
85 } 85 }
86 86
87 int 87 int
88 TimeInstantLayer::getPropertyRangeAndValue(const PropertyName &name, 88 TimeInstantLayer::getPropertyRangeAndValue(const PropertyName &name,
89 int *min, int *max) const 89 int *min, int *max, int *deflt) const
90 { 90 {
91 int deft = 0; 91 int val = 0;
92 92
93 if (name == "Colour") { 93 if (name == "Colour") {
94 94
95 if (min) *min = 0; 95 if (min) *min = 0;
96 if (max) *max = 5; 96 if (max) *max = 5;
97 97 if (deflt) *deflt = 0;
98 if (m_colour == Qt::black) deft = 0; 98
99 else if (m_colour == Qt::darkRed) deft = 1; 99 if (m_colour == Qt::black) val = 0;
100 else if (m_colour == Qt::darkBlue) deft = 2; 100 else if (m_colour == Qt::darkRed) val = 1;
101 else if (m_colour == Qt::darkGreen) deft = 3; 101 else if (m_colour == Qt::darkBlue) val = 2;
102 else if (m_colour == QColor(200, 50, 255)) deft = 4; 102 else if (m_colour == Qt::darkGreen) val = 3;
103 else if (m_colour == QColor(255, 150, 50)) deft = 5; 103 else if (m_colour == QColor(200, 50, 255)) val = 4;
104 else if (m_colour == QColor(255, 150, 50)) val = 5;
104 105
105 } else if (name == "Plot Type") { 106 } else if (name == "Plot Type") {
106 107
107 if (min) *min = 0; 108 if (min) *min = 0;
108 if (max) *max = 1; 109 if (max) *max = 1;
110 if (deflt) *deflt = 0;
109 111
110 deft = int(m_plotStyle); 112 val = int(m_plotStyle);
111 113
112 } else { 114 } else {
113 115
114 deft = Layer::getPropertyRangeAndValue(name, min, max); 116 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
115 } 117 }
116 118
117 return deft; 119 return val;
118 } 120 }
119 121
120 QString 122 QString
121 TimeInstantLayer::getPropertyValueLabel(const PropertyName &name, 123 TimeInstantLayer::getPropertyValueLabel(const PropertyName &name,
122 int value) const 124 int value) const