* Fixed broken sort order of all attributes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32498 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-18 16:43:56 +00:00
parent fe3763173c
commit 39fff75391
+17 -15
View File
@@ -594,7 +594,8 @@ StringAttributeText::Compare(WidgetAttributeText &attr, BPoseView *view)
if (fValueDirty) if (fValueDirty)
ReadValue(&fFullValueText); ReadValue(&fFullValueText);
return NaturalCompare(fFullValueText.String(), compareTo->ValueAsText(view)); return NaturalCompare(fFullValueText.String(),
compareTo->ValueAsText(view));
} }
@@ -678,7 +679,8 @@ ScalarAttributeText::Compare(WidgetAttributeText &attr, BPoseView *)
if (fValueDirty) if (fValueDirty)
fValue = ReadValue(); fValue = ReadValue();
return fValue >= compareTo->Value() ? (fValue == compareTo->Value() ? 0 : -1) : 1 ; return fValue >= compareTo->Value()
? (fValue == compareTo->Value() ? 0 : 1) : -1;
} }
@@ -1474,9 +1476,9 @@ GenericAttributeText::Compare(WidgetAttributeText &attr, BPoseView *)
// Sort undefined values last, regardless of the other value: // Sort undefined values last, regardless of the other value:
if (!fValueIsDefined) if (!fValueIsDefined)
return compareTo->fValueIsDefined ? -1 : 0; return compareTo->fValueIsDefined ? 1 : 0;
if (!compareTo->fValueIsDefined) if (!compareTo->fValueIsDefined)
return 1; return -1;
switch (fColumn->AttrType()) { switch (fColumn->AttrType()) {
case B_STRING_TYPE: case B_STRING_TYPE:
@@ -1495,52 +1497,52 @@ GenericAttributeText::Compare(WidgetAttributeText &attr, BPoseView *)
case B_FLOAT_TYPE: case B_FLOAT_TYPE:
return fValue.floatt >= compareTo->fValue.floatt ? return fValue.floatt >= compareTo->fValue.floatt ?
(fValue.floatt == compareTo->fValue.floatt ? 0 : -1) : 1; (fValue.floatt == compareTo->fValue.floatt ? 0 : 1) : -1;
case B_DOUBLE_TYPE: case B_DOUBLE_TYPE:
return fValue.doublet >= compareTo->fValue.doublet ? return fValue.doublet >= compareTo->fValue.doublet ?
(fValue.doublet == compareTo->fValue.doublet ? 0 : -1) : 1; (fValue.doublet == compareTo->fValue.doublet ? 0 : 1) : -1;
case B_BOOL_TYPE: case B_BOOL_TYPE:
return fValue.boolt >= compareTo->fValue.boolt ? return fValue.boolt >= compareTo->fValue.boolt ?
(fValue.boolt == compareTo->fValue.boolt ? 0 : -1) : 1; (fValue.boolt == compareTo->fValue.boolt ? 0 : 1) : -1;
case B_UINT8_TYPE: case B_UINT8_TYPE:
return fValue.uint8t >= compareTo->fValue.uint8t ? return fValue.uint8t >= compareTo->fValue.uint8t ?
(fValue.uint8t == compareTo->fValue.uint8t ? 0 : -1) : 1; (fValue.uint8t == compareTo->fValue.uint8t ? 0 : 1) : -1;
case B_INT8_TYPE: case B_INT8_TYPE:
return fValue.int8t >= compareTo->fValue.int8t ? return fValue.int8t >= compareTo->fValue.int8t ?
(fValue.int8t == compareTo->fValue.int8t ? 0 : -1) : 1; (fValue.int8t == compareTo->fValue.int8t ? 0 : 1) : -1;
case B_UINT16_TYPE: case B_UINT16_TYPE:
return fValue.uint16t >= compareTo->fValue.uint16t ? return fValue.uint16t >= compareTo->fValue.uint16t ?
(fValue.uint16t == compareTo->fValue.uint16t ? 0 : -1) : 1; (fValue.uint16t == compareTo->fValue.uint16t ? 0 : 1) : -1;
case B_INT16_TYPE: case B_INT16_TYPE:
return fValue.int16t >= compareTo->fValue.int16t ? return fValue.int16t >= compareTo->fValue.int16t ?
(fValue.int16t == compareTo->fValue.int16t ? 0 : -1) : 1; (fValue.int16t == compareTo->fValue.int16t ? 0 : 1) : -1;
case B_UINT32_TYPE: case B_UINT32_TYPE:
return fValue.uint32t >= compareTo->fValue.uint32t ? return fValue.uint32t >= compareTo->fValue.uint32t ?
(fValue.uint32t == compareTo->fValue.uint32t ? 0 : -1) : 1; (fValue.uint32t == compareTo->fValue.uint32t ? 0 : 1) : -1;
case B_TIME_TYPE: case B_TIME_TYPE:
// time_t typedef'd to a long, i.e. a int32 // time_t typedef'd to a long, i.e. a int32
case B_INT32_TYPE: case B_INT32_TYPE:
return fValue.int32t >= compareTo->fValue.int32t ? return fValue.int32t >= compareTo->fValue.int32t ?
(fValue.int32t == compareTo->fValue.int32t ? 0 : -1) : 1; (fValue.int32t == compareTo->fValue.int32t ? 0 : 1) : -1;
case B_OFF_T_TYPE: case B_OFF_T_TYPE:
// off_t typedef'd to a long long, i.e. a int64 // off_t typedef'd to a long long, i.e. a int64
case B_INT64_TYPE: case B_INT64_TYPE:
return fValue.int64t >= compareTo->fValue.int64t ? return fValue.int64t >= compareTo->fValue.int64t ?
(fValue.int64t == compareTo->fValue.int64t ? 0 : -1) : 1; (fValue.int64t == compareTo->fValue.int64t ? 0 : 1) : -1;
case B_UINT64_TYPE: case B_UINT64_TYPE:
default: default:
return fValue.uint64t >= compareTo->fValue.uint64t ? return fValue.uint64t >= compareTo->fValue.uint64t ?
(fValue.uint64t == compareTo->fValue.uint64t ? 0 : -1) : 1; (fValue.uint64t == compareTo->fValue.uint64t ? 0 : 1) : -1;
} }
return 0; return 0;
} }