[haiku-commits] r36506 - haiku/trunk/src/preferences/print

  • From: ithamar.adema@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 27 Apr 2010 18:48:18 +0200 (CEST)

Author: ithamar
Date: 2010-04-27 18:48:18 +0200 (Tue, 27 Apr 2010)
New Revision: 36506
Changeset: http://dev.haiku-os.org/changeset/36506/haiku

Modified:
   haiku/trunk/src/preferences/print/PrinterListView.cpp
Log:
* Truncate the strings displayed in the printer list properly.



Modified: haiku/trunk/src/preferences/print/PrinterListView.cpp
===================================================================
--- haiku/trunk/src/preferences/print/PrinterListView.cpp       2010-04-27 
16:04:34 UTC (rev 36505)
+++ haiku/trunk/src/preferences/print/PrinterListView.cpp       2010-04-27 
16:48:18 UTC (rev 36506)
@@ -402,13 +402,23 @@
        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);


Other related posts:

  • » [haiku-commits] r36506 - haiku/trunk/src/preferences/print - ithamar . adema