[haiku-commits] r38603 - haiku/trunk/src/apps/mediaplayer/interface

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 11 Sep 2010 10:54:14 +0200 (CEST)

Author: stippi
Date: 2010-09-11 10:54:14 +0200 (Sat, 11 Sep 2010)
New Revision: 38603
Changeset: http://dev.haiku-os.org/changeset/38603

Modified:
   haiku/trunk/src/apps/mediaplayer/interface/DurationView.cpp
Log:
Make sure the duration view has a fixed width for
all display modes for a given clip.


Modified: haiku/trunk/src/apps/mediaplayer/interface/DurationView.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/interface/DurationView.cpp 2010-09-11 
07:20:11 UTC (rev 38602)
+++ haiku/trunk/src/apps/mediaplayer/interface/DurationView.cpp 2010-09-11 
08:54:14 UTC (rev 38603)
@@ -52,14 +52,14 @@
 BSize
 DurationView::MinSize()
 {
-// If we wanted to have a fixed size:
-//     BSize size;
-//     size.width = StringWidth("-00:00:00");
-//     font_height fontHeight;
-//     GetFontHeight(&fontHeight);
-//     size.height = ceilf(fontHeight.ascent) + ceilf(fontHeight.descent);
-//     return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
-       return BStringView::MinSize();
+       BSize size;
+       char string[64];
+       duration_to_string(int32(fDuration / -1000000LL), string, 
sizeof(string));
+       size.width = StringWidth(string);
+       font_height fontHeight;
+       GetFontHeight(&fontHeight);
+       size.height = ceilf(fontHeight.ascent) + ceilf(fontHeight.descent);
+       return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
 }
 
 
@@ -80,7 +80,10 @@
                return;
 
        fPosition = position;
-       fDuration = duration;
+       if (fDuration != duration) {
+               fDuration = duration;
+               InvalidateLayout();
+       }
        _Update();
 }
 


Other related posts:

  • » [haiku-commits] r38603 - haiku/trunk/src/apps/mediaplayer/interface - superstippi