diff options
| author | Rene Gollent <anevilyak@gmail.com> | 2012-07-13 19:38:41 -0400 |
|---|---|---|
| committer | Rene Gollent <anevilyak@gmail.com> | 2012-07-13 19:38:41 -0400 |
| commit | 975867a4ffb3f114b8d6e5db0fb557fd9101e05a (patch) | |
| tree | be70a9b44702b2b873100e8e28ff4ee5a561499e | |
| parent | d826a252c1014a8dc171b752290b60df904aeb17 (diff) | |
Fix drawing bug in BStringField.hrev44333
- 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.
| -rw-r--r-- | src/kits/interface/ColumnTypes.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/kits/interface/ColumnTypes.cpp b/src/kits/interface/ColumnTypes.cpp index 5298f19276..82a8fef579 100644 --- a/src/kits/interface/ColumnTypes.cpp +++ b/src/kits/interface/ColumnTypes.cpp @@ -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)); |
