From 47a07cbf03c8dc04f7a2edbded15b23aa4dcf7da Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Tue, 27 Apr 2010 16:48:18 +0000 Subject: [PATCH] * Truncate the strings displayed in the printer list properly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36506 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/print/PrinterListView.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/preferences/print/PrinterListView.cpp b/src/preferences/print/PrinterListView.cpp index 2703c78eef..82a2d3ca64 100644 --- a/src/preferences/print/PrinterListView.cpp +++ b/src/preferences/print/PrinterListView.cpp @@ -402,13 +402,23 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete) owner->SetDrawingMode(B_OP_OVER); // left of item - owner->DrawString(fName.String(), fName.Length(), namePt); - owner->DrawString(fDriverName.String(), fDriverName.Length(), driverPt); + BString s = fName; + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, pendingPt.x - namePt.x); + owner->DrawString(s.String(), s.Length(), namePt); + s = fDriverName.String(); + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, pendingPt.x - driverPt.x); + owner->DrawString(s.String(), s.Length(), driverPt); // right of item - owner->DrawString(fPendingJobs.String(), fPendingJobs.Length(), pendingPt); - owner->DrawString(fTransport.String(), fTransport.Length(), transportPt); - owner->DrawString(fComments.String(), fComments.Length(), commentPt); + s = fPendingJobs; + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, bounds.Width() - pendingPt.x); + owner->DrawString(s.String(), s.Length(), pendingPt); + s = fTransport; + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, bounds.Width() - transportPt.x); + owner->DrawString(s.String(), s.Length(), transportPt); + s = fComments; + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, bounds.Width() - commentPt.x); + owner->DrawString(s.String(), s.Length(), commentPt); owner->SetDrawingMode(mode); owner->SetViewColor(oldViewColor);