Fix drawing bug in BStringField.
- If a string column was exactly the correct pixel width for the strings contained within it, they would skip attempting to truncate the string. However, the truncated string was always used for final drawing, with the end result that the fields would be drawn blank. This would sometimes manifest itself in Debugger where things like ID columns wound wind up showing no data until one resized the column.
This commit is contained in:
parent
d826a252c1
commit
975867a4ff
@ -130,7 +130,7 @@ BStringField::SetString(const char* val)
|
||||
fString = val;
|
||||
fClippedString = "";
|
||||
fWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
@ -158,7 +158,7 @@ void
|
||||
BStringField::SetClippedString(const char* val)
|
||||
{
|
||||
fClippedString = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
@ -184,15 +184,17 @@ BStringColumn::DrawField(BField* _field, BRect rect, BView* parent)
|
||||
{
|
||||
float width = rect.Width() - (2 * kTEXT_MARGIN);
|
||||
BStringField* field = static_cast<BStringField*>(_field);
|
||||
bool clipNeeded = width < field->Width();
|
||||
|
||||
if (width != field->Width()) {
|
||||
if (clipNeeded) {
|
||||
BString out_string(field->String());
|
||||
|
||||
parent->TruncateString(&out_string, fTruncate, width + 2);
|
||||
field->SetClippedString(out_string.String());
|
||||
field->SetWidth(width);
|
||||
}
|
||||
DrawString(field->ClippedString(), parent, rect);
|
||||
|
||||
DrawString(clipNeeded ? field->ClippedString() : field->String(), parent, rect);
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +258,7 @@ void
|
||||
BDateField::SetClippedString(const char* val)
|
||||
{
|
||||
fClippedString = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
@ -643,7 +645,7 @@ BBitmapColumn::CompareFields(BField* /*field1*/, BField* /*field2*/)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
BBitmapColumn::AcceptsField(const BField *field) const
|
||||
{
|
||||
return static_cast<bool>(dynamic_cast<const BBitmapField*>(field));
|
||||
|
Loading…
Reference in New Issue
Block a user