From f9f8bce6d2cd698887d896a76722e6d13d40d51b Mon Sep 17 00:00:00 2001 From: Janus Date: Sun, 31 May 2015 21:25:38 +0200 Subject: [PATCH] Printers: fix glitches in PrinterListView and JobListView. * Fix 12103. --- src/preferences/printers/JobListView.cpp | 8 ++++++-- src/preferences/printers/PrinterListView.cpp | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/preferences/printers/JobListView.cpp b/src/preferences/printers/JobListView.cpp index 81054a04c7..1114799831 100644 --- a/src/preferences/printers/JobListView.cpp +++ b/src/preferences/printers/JobListView.cpp @@ -311,8 +311,12 @@ JobItem::DrawItem(BView *owner, BRect, bool complete) owner->DrawBitmap(fIcon, iconPt); // left of item - owner->DrawString(fName.String(), fName.Length(), namePt); - owner->DrawString(fStatus.String(), fStatus.Length(), statusPt); + BString name = fName; + owner->TruncateString(&name, B_TRUNCATE_MIDDLE, pagePt.x - namePt.x); + owner->DrawString(name.String(), name.Length(), namePt); + BString status = fStatus; + owner->TruncateString(&status, B_TRUNCATE_MIDDLE, sizePt.x - statusPt.x); + owner->DrawString(status.String(), status.Length(), statusPt); // right of item owner->DrawString(fPages.String(), fPages.Length(), pagePt); diff --git a/src/preferences/printers/PrinterListView.cpp b/src/preferences/printers/PrinterListView.cpp index e384c7e886..d353287664 100644 --- a/src/preferences/printers/PrinterListView.cpp +++ b/src/preferences/printers/PrinterListView.cpp @@ -446,15 +446,14 @@ PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete) // left of item BString s = fName; - owner->TruncateString(&s, B_TRUNCATE_MIDDLE, pendingPt.x - namePt.x); - owner->SetFont(be_bold_font); + owner->TruncateString(&s, B_TRUNCATE_MIDDLE, pendingPt.x - namePt.x); owner->DrawString(s.String(), s.Length(), namePt); owner->SetFont(&font); s = B_TRANSLATE("Driver: %driver%"); s.ReplaceFirst("%driver%", fDriverName); - owner->TruncateString(&s, B_TRUNCATE_END, bounds.Width() - commentPt.x); + owner->TruncateString(&s, B_TRUNCATE_END, commentPt.x - driverPt.x); owner->DrawString(s.String(), s.Length(), driverPt); @@ -516,6 +515,7 @@ PrinterItem::UpdatePendingJobs() fPendingJobs = B_TRANSLATE("1 pending job."); return; } else if (pendingJobs > 1) { + fPendingJobs = ""; fPendingJobs << pendingJobs << B_TRANSLATE(" pending jobs."); return; }