[haiku-commits] haiku: hrev48714 - src/apps/mediaplayer src/preferences/mouse src/kits/interface headers/os/interface

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2015 21:01:13 +0100 (CET)

hrev48714 adds 9 changesets to branch 'master'
old head: 0e652ab2dc2bdb9bb84094ef8cd7d0fc05037a64
new head: 86f6a66bbe1c03bb92aabffbb3e6b7e5144bb78f
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=86f6a66bbe1c+%5E0e652ab2dc2b

----------------------------------------------------------------------------

1bfa46f23030: BLayoutBuilder::Grid: added spacing setters.

95fdee0bc0ac: BStringView: added truncation support.
  
  * Added new truncation mode B_NO_TRUNCATION.
  * The Truncation()/SetTruncation() methods itself are Dano-compatible,
    however, there was no B_NO_TRUNCATION.

88fed28aff16: MediaPlayer: reworked info window to use layout API.
  
  * Use BStringViews instead of BTextView - it's more flexible (truncation,
    and tool tips), and allows for fine grained updates.
  * The file name and location views are now showing tool tips with their
    full contents.
  * Also, its look is now less exotic, if boring.

ddf7ecfaa91f: E-mail: take fCheckMailCheckBox into account on save.
  
  * Only the time you entered mattered (ie. 0 would have turned
    the auto check off).

be9609b91c7e: Mouse: made the shadow an actual shadow.

637cd3124e65: Mouse: slightly improved the look of the mouse.
  
  * Made it a bit longer, and let the button outline stand out less.

9b2f5619083c: Mouse: minor cleanup.
  
  * Removed no longer used class members.
  * Synchronized implementation and declaration order.

27231d807a1b: ActivityMonitor: changed full legend width behavior.
  
  * Only use the full width if there is only a single item, otherwise
    I think it's more confusing than helpful.

86f6a66bbe1c: Mouse: make the buttons actually look pressed.
  
  * Just making the font bold looks ugly, lazy Adrien :-)

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

11 files changed, 646 insertions(+), 384 deletions(-)
headers/os/interface/Font.h               |   9 +-
headers/os/interface/LayoutBuilder.h      |  33 +-
headers/os/interface/StringView.h         |   7 +-
src/apps/activitymonitor/ActivityView.cpp |   6 +-
src/apps/mediaplayer/InfoWin.cpp          | 623 +++++++++++++++-----------
src/apps/mediaplayer/InfoWin.h            |  40 +-
src/kits/interface/Font.cpp               |   5 +-
src/kits/interface/StringView.cpp         |  92 ++--
src/preferences/mail/ConfigWindow.cpp     |  11 +-
src/preferences/mouse/MouseView.cpp       | 174 ++++---
src/preferences/mouse/MouseView.h         |  30 +-

############################################################################

Commit:      1bfa46f230304cd7898b657fefcf512f1686ecbe
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1bfa46f23030
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 09:03:54 2015 UTC

BLayoutBuilder::Grid: added spacing setters.

----------------------------------------------------------------------------

diff --git a/headers/os/interface/LayoutBuilder.h 
b/headers/os/interface/LayoutBuilder.h
index 1de6120..5f7c721 100644
--- a/headers/os/interface/LayoutBuilder.h
+++ b/headers/os/interface/LayoutBuilder.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009-2012, Haiku, Inc. All rights reserved.
+ * Copyright 2009-2015, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef        _LAYOUT_BUILDER_H
@@ -195,6 +195,10 @@ public:
        inline  ThisBuilder&            AddGlue(int32 column, int32 row,
                                                                        int32 
columnCount = 1, int32 rowCount = 1);
 
+       inline  ThisBuilder&            SetHorizontalSpacing(float spacing);
+       inline  ThisBuilder&            SetVerticalSpacing(float spacing);
+       inline  ThisBuilder&            SetSpacing(float horizontal, float 
vertical);
+
        inline  ThisBuilder&            SetColumnWeight(int32 column, float 
weight);
        inline  ThisBuilder&            SetRowWeight(int32 row, float weight);
 
@@ -893,6 +897,33 @@ Grid<ParentBuilder>::AddGlue(int32 column, int32 row, 
int32 columnCount,
 
 template<typename ParentBuilder>
 typename Grid<ParentBuilder>::ThisBuilder&
+Grid<ParentBuilder>::SetHorizontalSpacing(float spacing)
+{
+       fLayout->SetHorizontalSpacing(spacing);
+       return *this;
+}
+
+
+template<typename ParentBuilder>
+typename Grid<ParentBuilder>::ThisBuilder&
+Grid<ParentBuilder>::SetVerticalSpacing(float spacing)
+{
+       fLayout->SetVerticalSpacing(spacing);
+       return *this;
+}
+
+
+template<typename ParentBuilder>
+typename Grid<ParentBuilder>::ThisBuilder&
+Grid<ParentBuilder>::SetSpacing(float horizontal, float vertical)
+{
+       fLayout->SetSpacing(horizontal, vertical);
+       return *this;
+}
+
+
+template<typename ParentBuilder>
+typename Grid<ParentBuilder>::ThisBuilder&
 Grid<ParentBuilder>::SetColumnWeight(int32 column, float weight)
 {
        fLayout->SetColumnWeight(column, weight);

############################################################################

Commit:      95fdee0bc0ac24d9df13391dd8332fcee64dc94c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=95fdee0bc0ac
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 09:08:06 2015 UTC

BStringView: added truncation support.

* Added new truncation mode B_NO_TRUNCATION.
* The Truncation()/SetTruncation() methods itself are Dano-compatible,
  however, there was no B_NO_TRUNCATION.

----------------------------------------------------------------------------

diff --git a/headers/os/interface/Font.h b/headers/os/interface/Font.h
index 7b7cd0e..eb7d59c 100644
--- a/headers/os/interface/Font.h
+++ b/headers/os/interface/Font.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2009, Haiku, Inc. All rights reserved.
+ * Copyright 2005-2015, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _FONT_H_
@@ -43,6 +43,7 @@ enum {
 
 // truncation modes
 enum {
+       B_NO_TRUNCATION                 = ~0U,
        B_TRUNCATE_END                  = 0,
        B_TRUNCATE_BEGINNING    = 1,
        B_TRUNCATE_MIDDLE               = 2,
@@ -150,7 +151,7 @@ struct font_cache_info {
 
 struct tuned_font_info {
        float    size;
-       float    shear; 
+       float    shear;
        float    rotation;
        uint32   flags;
        uint16   face;
@@ -275,7 +276,7 @@ private:
                friend void _init_global_fonts_();
 
                        void                            _GetExtraFlags() const;
-                       void                            _GetBoundingBoxes(const 
char charArray[], 
+                       void                            _GetBoundingBoxes(const 
char charArray[],
                                                                        int32 
numChars, font_metric_mode mode,
                                                                        bool 
string_escapement,
                                                                        
escapement_delta* delta,
@@ -313,7 +314,7 @@ status_t get_font_family(int32 index, font_family* name,
 int32 count_font_styles(font_family name);
 status_t get_font_style(font_family family, int32 index, font_style* name,
        uint32* flags = NULL);
-status_t get_font_style(font_family family, int32 index, font_style* name, 
+status_t get_font_style(font_family family, int32 index, font_style* name,
        uint16* face, uint32* flags = NULL);
 bool update_font_families(bool checkOnly);
 
diff --git a/headers/os/interface/StringView.h 
b/headers/os/interface/StringView.h
index eae6492..820b41a 100644
--- a/headers/os/interface/StringView.h
+++ b/headers/os/interface/StringView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2009, Haiku, Inc. All rights reserved.
+ * Copyright 2001-2015, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _STRING_VIEW_H
@@ -28,6 +28,8 @@ public:
                        const char*                     Text() const;
                        void                            SetAlignment(alignment 
flag);
                        alignment                       Alignment() const;
+                       void                            SetTruncation(uint32 
truncationMode);
+                       uint32                          Truncation() const;
 
        virtual void                            AttachedToWindow();
        virtual void                            DetachedFromWindow();
@@ -80,9 +82,10 @@ private:
 
 private:
                        char*                           fText;
-                       float                           fStringWidth;
+                       uint32                          fTruncation;
                        alignment                       fAlign;
                        BSize                           fPreferredSize;
 };
 
+
 #endif // _STRING_VIEW_H
diff --git a/src/kits/interface/Font.cpp b/src/kits/interface/Font.cpp
index 796b6f5..804307f 100644
--- a/src/kits/interface/Font.cpp
+++ b/src/kits/interface/Font.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2014, Haiku, Inc.
+ * Copyright 2001-2015, Haiku, Inc.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -908,6 +908,9 @@ BFont::GetTunedInfo(int32 index, tuned_font_info* info) 
const
 void
 BFont::TruncateString(BString* inOut, uint32 mode, float width) const
 {
+       if (mode == B_NO_TRUNCATION)
+               return;
+
        // NOTE: Careful, we cannot directly use "inOut->String()" as result
        // array, because the string length increases by 3 bytes in the worst
        // case scenario.
diff --git a/src/kits/interface/StringView.cpp 
b/src/kits/interface/StringView.cpp
index 2cc6f5b..e4d1ca7 100644
--- a/src/kits/interface/StringView.cpp
+++ b/src/kits/interface/StringView.cpp
@@ -1,13 +1,15 @@
 /*
- * Copyright 2001-2008, Haiku, Inc. All rights reserved.
+ * Copyright 2001-2015, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
+ *             Stephan Aßmus <superstippi@xxxxxx>
+ *             Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
  *             Frans van Nispen (xlr8@xxxxxxx)
  *             Ingo Weinhold <ingo_weinhold@xxxxxx>
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
 
+
 //!    BStringView draws a non-editable text string.
 
 
@@ -50,9 +52,9 @@ BStringView::BStringView(BRect frame, const char* name, const 
char* text,
        :
        BView(frame, name, resizingMode, flags | B_FULL_UPDATE_ON_RESIZE),
        fText(text ? strdup(text) : NULL),
-       fStringWidth(text ? StringWidth(text) : 0.0),
+       fTruncation(B_NO_TRUNCATION),
        fAlign(B_ALIGN_LEFT),
-       fPreferredSize(-1, -1)
+       fPreferredSize(text ? StringWidth(text) : 0.0, -1)
 {
 }
 
@@ -61,9 +63,9 @@ BStringView::BStringView(const char* name, const char* text, 
uint32 flags)
        :
        BView(name, flags | B_FULL_UPDATE_ON_RESIZE),
        fText(text ? strdup(text) : NULL),
-       fStringWidth(text ? StringWidth(text) : 0.0),
+       fTruncation(B_NO_TRUNCATION),
        fAlign(B_ALIGN_LEFT),
-       fPreferredSize(-1, -1)
+       fPreferredSize(text ? StringWidth(text) : 0.0, -1)
 {
 }
 
@@ -72,18 +74,13 @@ BStringView::BStringView(BMessage* archive)
        :
        BView(archive),
        fText(NULL),
-       fStringWidth(0.0),
-       fPreferredSize(-1, -1)
+       fTruncation(B_NO_TRUNCATION),
+       fPreferredSize(0, -1)
 {
-       int32 align;
-       if (archive->FindInt32("_align", &align) == B_OK)
-               fAlign = (alignment)align;
-       else
-               fAlign = B_ALIGN_LEFT;
+       fAlign = (alignment)archive->GetInt32("_align", B_ALIGN_LEFT);
+       fTruncation = (uint32)archive->GetInt32("_truncation", B_NO_TRUNCATION);
 
-       const char* text;
-       if (archive->FindString("_text", &text) != B_OK)
-               text = NULL;
+       const char* text = archive->GetString("_text", NULL);
 
        SetText(text);
        SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE);
@@ -112,15 +109,16 @@ BStringView::Instantiate(BMessage* data)
 status_t
 BStringView::Archive(BMessage* data, bool deep) const
 {
-       status_t err = BView::Archive(data, deep);
+       status_t status = BView::Archive(data, deep);
 
-       if (err == B_OK && fText)
-               err = data->AddString("_text", fText);
+       if (status == B_OK && fText)
+               status = data->AddString("_text", fText);
+       if (status == B_OK && fTruncation != B_NO_TRUNCATION)
+               status = data->AddInt32("_truncation", fTruncation);
+       if (status == B_OK)
+               status = data->AddInt32("_align", fAlign);
 
-       if (err == B_OK)
-               err = data->AddInt32("_align", fAlign);
-
-       return err;
+       return status;
 }
 
 
@@ -263,16 +261,28 @@ BStringView::Draw(BRect updateRect)
 
        BRect bounds = Bounds();
 
+       const char* text = fText;
+       float width = fPreferredSize.width;
+       BString truncated;
+       if (fTruncation != B_NO_TRUNCATION && width > bounds.Width()) {
+               // The string needs to be truncated
+               // TODO: we should cache this
+               truncated = fText;
+               TruncateString(&truncated, fTruncation, bounds.Width());
+               text = truncated.String();
+               width = StringWidth(text);
+       }
+
        float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
                - ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);
        float x;
        switch (fAlign) {
                case B_ALIGN_RIGHT:
-                       x = bounds.Width() - fStringWidth;
+                       x = bounds.Width() - width;
                        break;
 
                case B_ALIGN_CENTER:
-                       x = (bounds.Width() - fStringWidth) / 2.0;
+                       x = (bounds.Width() - width) / 2.0;
                        break;
 
                default:
@@ -280,7 +290,7 @@ BStringView::Draw(BRect updateRect)
                        break;
        }
 
-       DrawString(fText, BPoint(x, y));
+       DrawString(text, BPoint(x, y));
 }
 
 
@@ -370,8 +380,8 @@ BStringView::SetText(const char* text)
        fText = text ? strdup(text) : NULL;
 
        float newStringWidth = StringWidth(fText);
-       if (fStringWidth != newStringWidth) {
-               fStringWidth = newStringWidth;
+       if (fPreferredSize.width != newStringWidth) {
+               fPreferredSize.width = newStringWidth;
                InvalidateLayout();
        }
 
@@ -401,6 +411,23 @@ BStringView::Alignment() const
 }
 
 
+void
+BStringView::SetTruncation(uint32 truncationMode)
+{
+       if (fTruncation != truncationMode) {
+               fTruncation = truncationMode;
+               Invalidate();
+       }
+}
+
+
+uint32
+BStringView::Truncation() const
+{
+       return fTruncation;
+}
+
+
 BHandler*
 BStringView::ResolveSpecifier(BMessage* message, int32 index,
        BMessage* specifier, int32 form, const char* property)
@@ -437,7 +464,7 @@ BStringView::SetFont(const BFont* font, uint32 mask)
 {
        BView::SetFont(font, mask);
 
-       fStringWidth = StringWidth(fText);
+       fPreferredSize.width = StringWidth(fText);
 
        Invalidate();
        InvalidateLayout();
@@ -448,7 +475,7 @@ void
 BStringView::LayoutInvalidated(bool descendants)
 {
        // invalidate cached preferred size
-       fPreferredSize.Set(-1, -1);
+       fPreferredSize.height = -1;
 }
 
 
@@ -541,10 +568,7 @@ BStringView::operator=(const BStringView&)
 BSize
 BStringView::_ValidatePreferredSize()
 {
-       if (fPreferredSize.width < 0) {
-               // width
-               fPreferredSize.width = ceilf(fStringWidth);
-
+       if (fPreferredSize.height < 0) {
                // height
                font_height fontHeight;
                GetFontHeight(&fontHeight);

############################################################################

Commit:      88fed28aff163cd10866c60325e9630de154acb1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=88fed28aff16
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 09:15:53 2015 UTC

MediaPlayer: reworked info window to use layout API.

* Use BStringViews instead of BTextView - it's more flexible (truncation,
  and tool tips), and allows for fine grained updates.
* The file name and location views are now showing tool tips with their
  full contents.
* Also, its look is now less exotic, if boring.

----------------------------------------------------------------------------

diff --git a/src/apps/mediaplayer/InfoWin.cpp b/src/apps/mediaplayer/InfoWin.cpp
index 1839c61..eea4e91 100644
--- a/src/apps/mediaplayer/InfoWin.cpp
+++ b/src/apps/mediaplayer/InfoWin.cpp
@@ -2,6 +2,7 @@
  * InfoWin.cpp - Media Player for the Haiku Operating System
  *
  * Copyright (C) 2006 Marcus Overhagen <marcus@xxxxxxxxxxxx>
+ * Copyright 2015 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -27,7 +28,9 @@
 
 #include <Bitmap.h>
 #include <Catalog.h>
+#include <ControlLook.h>
 #include <Debug.h>
+#include <LayoutBuilder.h>
 #include <MediaDefs.h>
 #include <MessageFormat.h>
 #include <Mime.h>
@@ -43,86 +46,57 @@
 #include "PlaylistItem.h"
 
 
-#define NAME "File info"
-#define MIN_WIDTH 400
+#define MIN_WIDTH 500
 
-#define BASE_HEIGHT (32 + 32)
-
-//const rgb_color kGreen = { 152, 203, 152, 255 };
-const rgb_color kRed =   { 203, 152, 152, 255 };
-const rgb_color kBlue =  {   0,   0, 220, 255 };
-const rgb_color kGreen = { 171, 221, 161, 255 };
-const rgb_color kBlack = {   0,   0,   0, 255 };
 
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "MediaPlayer-InfoWin"
 
-// should later draw an icon
-class InfoView : public BView {
+
+class IconView : public BView {
 public:
-                                               InfoView(BRect frame, const 
char* name, float divider);
-       virtual                         ~InfoView();
-       virtual void            Draw(BRect updateRect);
+                                                               IconView(const 
char* name, int32 iconSize);
+       virtual                                         ~IconView();
+
+                       status_t                        SetIcon(const 
PlaylistItem* item);
+                       status_t                        SetIcon(const char* 
mimeType);
+                       void                            SetGenericIcon();
 
-                       status_t        SetIcon(const PlaylistItem* item);
-                       status_t        SetIcon(const char* mimeType);
-                       void            SetGenericIcon();
+       virtual void                            GetPreferredSize(float* _width, 
float* _height);
+       virtual void                            AttachedToWindow();
+       virtual void                            Draw(BRect updateRect);
 
 private:
-                       float           fDivider;
-                       BBitmap*        fIconBitmap;
+                       BBitmap*                        fIconBitmap;
 };
 
 
-InfoView::InfoView(BRect frame, const char *name, float divider)
-       : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | 
B_FULL_UPDATE_ON_RESIZE),
-         fDivider(divider),
-         fIconBitmap(NULL)
+IconView::IconView(const char* name, int32 iconSize)
+       :
+       BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
+       fIconBitmap(NULL)
 {
-       BRect rect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1);
-
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
-       fIconBitmap = new BBitmap(rect, B_RGBA32);
-#else
-       fIconBitmap = new BBitmap(rect, B_CMAP8);
-#endif
+       fIconBitmap = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1),
+               B_RGBA32);
+       SetExplicitMaxSize(PreferredSize());
 }
 
 
-InfoView::~InfoView()
+IconView::~IconView()
 {
        delete fIconBitmap;
 }
 
-void
-InfoView::Draw(BRect updateRect)
-{
-       SetHighColor(kGreen);
-       BRect r(Bounds());
-       r.right = r.left + fDivider;
-       FillRect(r);
-
-       if (fIconBitmap) {
-               float left = r.left + ( r.right - r.left ) / 2 - B_LARGE_ICON / 
2;
-               SetDrawingMode(B_OP_ALPHA);
-               DrawBitmap(fIconBitmap, BPoint(left, r.top + B_LARGE_ICON / 2));
-       }
-
-       SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
-       r.left = r.right;
-       FillRect(r);
-}
-
 
 status_t
-InfoView::SetIcon(const PlaylistItem* item)
+IconView::SetIcon(const PlaylistItem* item)
 {
        return item->GetIcon(fIconBitmap, B_LARGE_ICON);
 }
 
 
 status_t
-InfoView::SetIcon(const char* mimeTypeString)
+IconView::SetIcon(const char* mimeTypeString)
 {
        if (!mimeTypeString)
                return B_BAD_VALUE;
@@ -144,7 +118,7 @@ InfoView::SetIcon(const char* mimeTypeString)
 
 
 void
-InfoView::SetGenericIcon()
+IconView::SetGenericIcon()
 {
        // get default icon
        BMimeType genericType(B_FILE_MIME_TYPE);
@@ -159,67 +133,133 @@ InfoView::SetGenericIcon()
 }
 
 
+void
+IconView::GetPreferredSize(float* _width, float* _height)
+{
+       if (_width != NULL) {
+               *_width = fIconBitmap->Bounds().Width()
+                       + 2 * be_control_look->DefaultItemSpacing();
+       }
+       if (_height != NULL) {
+               *_height = fIconBitmap->Bounds().Height()
+                       + 2 * be_control_look->DefaultItemSpacing();
+       }
+}
+
+
+void
+IconView::AttachedToWindow()
+{
+       if (Parent() != NULL)
+               SetViewColor(Parent()->ViewColor());
+       else
+               SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+}
+
+
+void
+IconView::Draw(BRect updateRect)
+{
+       BRect rect(Bounds());
+
+       if (fIconBitmap != NULL) {
+               // Draw bitmap centered within the view
+               SetDrawingMode(B_OP_ALPHA);
+               DrawBitmap(fIconBitmap, BPoint(rect.left
+                               + (rect.Width() - 
fIconBitmap->Bounds().Width()) / 2,
+                       rect.top + (rect.Height() - 
fIconBitmap->Bounds().Height()) / 2));
+       }
+}
+
+
 // #pragma mark -
 
 
 InfoWin::InfoWin(BPoint leftTop, Controller* controller)
        :
        BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1,
-               leftTop.y + 300), B_TRANSLATE(NAME), B_TITLED_WINDOW,
-               B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
+               leftTop.y + 300), B_TRANSLATE("File info"), B_TITLED_WINDOW,
+               B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS | 
B_NOT_ZOOMABLE),
        fController(controller),
        fControllerObserver(new ControllerObserver(this,
                OBSERVE_FILE_CHANGES | OBSERVE_TRACK_CHANGES | 
OBSERVE_STAT_CHANGES))
 {
-       BRect rect = Bounds();
-
-       // accomodate for big fonts
-       float div = max_c(2 * 32, be_plain_font->StringWidth(
-               B_TRANSLATE("Display Mode")) + 10);
-
-       fInfoView = new InfoView(rect, "background", div);
-       fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
-       AddChild(fInfoView);
+       fIconView = new IconView("background", B_LARGE_ICON);
 
+       fFilenameView = _CreateInfo("filename");
        BFont bigFont(be_plain_font);
-       bigFont.SetSize(bigFont.Size() + 6);
-       font_height fh;
-       bigFont.GetHeight(&fh);
-       fFilenameView = new BStringView(
-               BRect(div + 10, 20, rect.right - 10, 20 + fh.ascent + 5),
-               "filename", "");
-       AddChild(fFilenameView);
+       bigFont.SetSize(bigFont.Size() * 1.5f);
        fFilenameView->SetFont(&bigFont);
-       fFilenameView->SetViewColor(fInfoView->ViewColor());
-       fFilenameView->SetLowColor(fInfoView->ViewColor());
-#ifdef B_BEOS_VERSION_DANO /* maybe we should support that as well ? */
-       fFilenameView->SetTruncation(B_TRUNCATE_END);
-#endif
-
-       rect.top = BASE_HEIGHT;
-
-       BRect lr(rect);
-       BRect cr(rect);
-       lr.right = div - 1;
-       cr.left = div + 1;
-       BRect tr;
-       tr = lr.OffsetToCopy(0, 0).InsetByCopy(5, 1);
-       fLabelsView = new BTextView(lr, "labels", tr, B_FOLLOW_BOTTOM);
-       fLabelsView->SetViewColor(kGreen);
-       fLabelsView->SetAlignment(B_ALIGN_RIGHT);
-       fLabelsView->SetWordWrap(false);
-       AddChild(fLabelsView);
-       tr = cr.OffsetToCopy(0, 0).InsetByCopy(10, 1);
-       fContentsView = new BTextView(cr, "contents", tr, B_FOLLOW_BOTTOM);
-       fContentsView->SetWordWrap(false);
-       AddChild(fContentsView);
-
-       fLabelsView->MakeSelectable();
-       fContentsView->MakeSelectable();
+
+       // Create info views
+
+       BStringView* containerLabel = _CreateLabel("containerLabel",
+               B_TRANSLATE("Container"));
+       fContainerInfo = _CreateInfo("container");
+
+       fVideoSeparator = _CreateSeparator();
+       fVideoLabel = _CreateLabel("videoLabel", B_TRANSLATE("Video"));
+       fVideoFormatInfo = _CreateInfo("videoFormat");
+       fVideoConfigInfo = _CreateInfo("videoConfig");
+       fDisplayModeLabel = _CreateLabel("displayModeLabel",
+               B_TRANSLATE("Display mode"));
+       fDisplayModeInfo = _CreateInfo("displayMode");
+
+       fAudioSeparator = _CreateSeparator();
+       fAudioLabel = _CreateLabel("audioLabel", B_TRANSLATE("Audio"));
+       fAudioFormatInfo = _CreateInfo("audioFormat");
+       fAudioConfigInfo = _CreateInfo("audioConfig");
+
+       BStringView* durationLabel = _CreateLabel("durationLabel",
+               B_TRANSLATE("Duration"));
+       fDurationInfo = _CreateInfo("duration");
+
+       BStringView* locationLabel = _CreateLabel("locationLabel",
+               B_TRANSLATE("Location"));
+       fLocationInfo = _CreateInfo("location");
+
+       fCopyrightSeparator = _CreateSeparator();
+       fCopyrightLabel = _CreateLabel("copyrightLabel", 
B_TRANSLATE("Copyright"));
+       fCopyrightInfo = _CreateInfo("copyright");
+
+       BLayoutBuilder::Group<>(this, B_VERTICAL)
+               .SetInsets(B_USE_DEFAULT_SPACING)
+               .AddGroup(B_HORIZONTAL)
+                       .Add(fIconView, 0)
+                       .Add(fFilenameView, 1)
+                       .End()
+               .AddGrid(2, 13)
+                       .Add(containerLabel, 0, 0)
+                       .Add(fContainerInfo, 1, 0)
+                       .Add(fVideoSeparator, 0, 1)
+                       .Add(fVideoLabel, 0, 2)
+                       .Add(fVideoFormatInfo, 1, 2)
+                       .Add(fVideoConfigInfo, 1, 3)
+                       .Add(fDisplayModeLabel, 0, 4)
+                       .Add(fDisplayModeInfo, 1, 4)
+                       .Add(fAudioSeparator, 0, 5)
+                       .Add(fAudioLabel, 0, 6)
+                       .Add(fAudioFormatInfo, 1, 6)
+                       .Add(fAudioConfigInfo, 1, 7)
+                       .Add(_CreateSeparator(), 0, 8)
+                       .Add(durationLabel, 0, 9)
+                       .Add(fDurationInfo, 1, 9)
+                       .Add(_CreateSeparator(), 0, 10)
+                       .Add(locationLabel, 0, 11)
+                       .Add(fLocationInfo, 1, 11)
+                       .Add(fCopyrightSeparator, 0, 12)
+                       .Add(fCopyrightLabel, 0, 12)
+                       .Add(fCopyrightInfo, 1, 12)
+                       .SetColumnWeight(0, 0)
+                       .SetColumnWeight(1, 1)
+                       .SetSpacing(B_USE_DEFAULT_SPACING, 0)
+                       .SetExplicitMinSize(BSize(MIN_WIDTH, B_SIZE_UNSET));
 
        fController->AddListener(fControllerObserver);
        Update();
 
+       UpdateSizeLimits();
+
        // Move window on screen if needed
        BScreen screen(this);
        if (screen.Frame().bottom < Frame().bottom)
@@ -238,15 +278,6 @@ InfoWin::~InfoWin()
 }
 
 
-// #pragma mark -
-
-
-void
-InfoWin::FrameResized(float newWidth, float newHeight)
-{
-}
-
-
 void
 InfoWin::MessageReceived(BMessage* msg)
 {
@@ -257,14 +288,14 @@ InfoWin::MessageReceived(BMessage* msg)
                        Update(INFO_ALL);
                        break;
                case MSG_CONTROLLER_VIDEO_TRACK_CHANGED:
-                       Update(/*INFO_VIDEO | INFO_STATS*/INFO_ALL);
+                       Update(INFO_VIDEO | INFO_STATS);
                        break;
                case MSG_CONTROLLER_AUDIO_TRACK_CHANGED:
-                       Update(/*INFO_AUDIO | INFO_STATS*/INFO_ALL);
+                       Update(INFO_AUDIO | INFO_STATS);
                        break;
                case MSG_CONTROLLER_VIDEO_STATS_CHANGED:
                case MSG_CONTROLLER_AUDIO_STATS_CHANGED:
-                       Update(/*INFO_STATS*/INFO_ALL);
+                       Update(INFO_STATS);
                        break;
                default:
                        BWindow::MessageReceived(msg);
@@ -294,226 +325,302 @@ InfoWin::Pulse()
 
 
 void
-InfoWin::ResizeToPreferred()
+InfoWin::Update(uint32 which)
 {
+       if (!fController->Lock())
+               return;
+
+       if ((which & INFO_FILE) != 0)
+               _UpdateFile();
+
+       // video track format information
+       if ((which & INFO_VIDEO) != 0)
+               _UpdateVideo();
+
+       // audio track format information
+       if ((which & INFO_AUDIO) != 0)
+               _UpdateAudio();
+
+       // statistics
+       if ((which & INFO_STATS) != 0) {
+               _UpdateDuration();
+               // TODO: demux/video/audio/... perfs (Kb/info)
+       }
+
+       if ((which & INFO_TRANSPORT) != 0) {
+               // Transport protocol info (file, http, rtsp, ...)
+       }
+
+       if ((which & INFO_COPYRIGHT)!=0)
+               _UpdateCopyright();
+
+       fController->Unlock();
 }
 
 
 void
-InfoWin::Update(uint32 which)
+InfoWin::_UpdateFile()
 {
-printf("InfoWin::Update(0x%08" B_PRIx32 ")\n", which);
-       fLabelsView->SetText("");
-       fContentsView->SetText("");
-       fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue);
-       fLabelsView->Insert(" ");
-       fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL);
-//     fContentsView->Insert("");
+       bool iconSet = false;
+       if (fController->HasFile()) {
+               const PlaylistItem* item = fController->Item();
+               iconSet = fIconView->SetIcon(item) == B_OK;
+               media_file_format fileFormat;
+               status_t status = fController->GetFileFormatInfo(&fileFormat);
+               if (status == B_OK) {
+                       fContainerInfo->SetText(fileFormat.pretty_name);
+                       if (!iconSet)
+                               iconSet = 
fIconView->SetIcon(fileFormat.mime_type) == B_OK;
+               } else
+                       fContainerInfo->SetText(strerror(status));
+
+               BString info;
+               if (fController->GetLocation(&info) != B_OK)
+                       info = B_TRANSLATE("<unknown>");
+               fLocationInfo->SetText(info.String());
+               fLocationInfo->SetToolTip(info.String());
+
+               if (fController->GetName(&info) != B_OK || info.IsEmpty())
+                       info = B_TRANSLATE("<unnamed media>");
+               fFilenameView->SetText(info.String());
+               fFilenameView->SetToolTip(info.String());
+       } else {
+               fFilenameView->SetText(B_TRANSLATE("<no media>"));
+               fContainerInfo->SetText("-");
+               fLocationInfo->SetText("-");
+       }
 
-       if (!fController->Lock())
-               return;
+       if (!iconSet)
+               fIconView->SetGenericIcon();
+}
 
-       fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed);
 
-       status_t err;
-       // video track format information
-       if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) {
-               BString label = B_TRANSLATE("Video");
-               fLabelsView->Insert(label << "\n\n\n");
-               BString s;
+void
+InfoWin::_UpdateVideo()
+{
+       bool visible = fController->VideoTrackCount() > 0;
+       if (visible) {
+               BString info;
                media_format format;
                media_raw_video_format videoFormat = {};
-               err = fController->GetEncodedVideoFormat(&format);
-               if (err < B_OK) {
-                       s << "(" << strerror(err) << ")\n";
+               status_t status = fController->GetEncodedVideoFormat(&format);
+               if (status != B_OK) {
+                       info << "(" << strerror(status) << ")\n";
                } else if (format.type == B_MEDIA_ENCODED_VIDEO) {
                        videoFormat = format.u.encoded_video.output;
                        media_codec_info mci;
-                       err = fController->GetVideoCodecInfo(&mci);
-                       if (err < B_OK) {
-                               s << B_TRANSLATE("Haiku Media Kit: ") << 
strerror(err);
+                       status = fController->GetVideoCodecInfo(&mci);
+                       if (status != B_OK) {
                                if (format.user_data_type == B_CODEC_TYPE_INFO) 
{
-                                       s << (char *)format.user_data << " "
+                                       info << (char *)format.user_data << " "
                                                << B_TRANSLATE("(not 
supported)");
-                               }
+                               } else
+                                       info = strerror(status);
                        } else
-                               s << mci.pretty_name; //<< "(" << 
mci.short_name << ")";
+                               info << mci.pretty_name; //<< "(" << 
mci.short_name << ")";
                } else if (format.type == B_MEDIA_RAW_VIDEO) {
                        videoFormat = format.u.raw_video;
-                       s << B_TRANSLATE("raw video");
+                       info << B_TRANSLATE("raw video");
                } else
-                       s << B_TRANSLATE("unknown format");
-               s << "\n";
-               s << format.Width() << " x " << format.Height();
+                       info << B_TRANSLATE("unknown format");
+
+               fVideoFormatInfo->SetText(info.String());
+
+               info.SetToFormat("%" B_PRIu32 " x %" B_PRIu32, format.Width(),
+                       format.Height());
+
                // encoded has output as 1st field...
                char fpsString[20];
                snprintf(fpsString, sizeof(fpsString), B_TRANSLATE("%.3f fps"),
                        videoFormat.field_rate);
-               s << ", " << fpsString << "\n\n";
-               fContentsView->Insert(s.String());
+               info << ", " << fpsString;
+
+               fVideoConfigInfo->SetText(info.String());
+
+               if (fController->IsOverlayActive())
+                       fDisplayModeInfo->SetText(B_TRANSLATE("Overlay"));
+               else
+                       fDisplayModeInfo->SetText(B_TRANSLATE("DrawBitmap"));
        }
 
-       // audio track format information
-       if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) {
-               BString label = B_TRANSLATE("Audio");
-               fLabelsView->Insert(label << "\n\n\n");
-               BString s;
+       fVideoSeparator->SetVisible(visible);
+       _SetVisible(fVideoLabel, visible);
+       _SetVisible(fVideoFormatInfo, visible);
+       _SetVisible(fVideoConfigInfo, visible);
+       _SetVisible(fDisplayModeLabel, visible);
+       _SetVisible(fDisplayModeInfo, visible);
+}
+
+
+void
+InfoWin::_UpdateAudio()
+{
+       bool visible = fController->AudioTrackCount() > 0;
+       if (visible) {
+               BString info;
                media_format format;
                media_raw_audio_format audioFormat = {};
-               err = fController->GetEncodedAudioFormat(&format);
-               //string_for_format(format, buf, sizeof(buf));
-               //printf("%s\n", buf);
-               if (err < 0) {
-                       s << "(" << strerror(err) << ")\n";
+
+               status_t status = fController->GetEncodedAudioFormat(&format);
+               if (status != B_OK) {
+                       info << "(" << strerror(status) << ")\n";
                } else if (format.type == B_MEDIA_ENCODED_AUDIO) {
                        audioFormat = format.u.encoded_audio.output;
                        media_codec_info mci;
-                       err = fController->GetAudioCodecInfo(&mci);
-                       if (err < 0) {
-                               s << B_TRANSLATE("Haiku Media Kit: ") << 
strerror(err);
+                       status = fController->GetAudioCodecInfo(&mci);
+                       if (status != B_OK) {
                                if (format.user_data_type == B_CODEC_TYPE_INFO) 
{
-                                       s << (char *)format.user_data << " "
+                                       info << (char *)format.user_data << " "
                                                << B_TRANSLATE("(not 
supported)");
-                               }
+                               } else
+                                       info = strerror(status);
                        } else
-                               s << mci.pretty_name; //<< "(" << 
mci.short_name << ")";
+                               info = mci.pretty_name;
                } else if (format.type == B_MEDIA_RAW_AUDIO) {
                        audioFormat = format.u.raw_audio;
-                       s << B_TRANSLATE("raw audio");
+                       info = B_TRANSLATE("raw audio");
                } else
-                       s << B_TRANSLATE("unknown format");
-               s << "\n";
+                       info = B_TRANSLATE("unknown format");
+
+               fAudioFormatInfo->SetText(info.String());
+
                uint32 bitsPerSample = 8 * (audioFormat.format
                        & media_raw_audio_format::B_AUDIO_SIZE_MASK);
                uint32 channelCount = audioFormat.channel_count;
                float sr = audioFormat.frame_rate;
 
+               info.Truncate(0);
+
                if (bitsPerSample > 0) {
                        char bitString[20];
                        snprintf(bitString, sizeof(bitString), B_TRANSLATE("%d 
Bit"),
                                bitsPerSample);
-                       s << bitString << " ";
+                       info << bitString << " ";
                }
 
                static BMessageFormat channelFormat(B_TRANSLATE(
                        "{0, plural, =1{Mono} =2{Stereo} other{# Channels}}"));
-               channelFormat.Format(s, channelCount);
+               channelFormat.Format(info, channelCount);
 
-               s << ", ";
+               info << ", ";
                if (sr > 0.0) {
                        char rateString[20];
                        snprintf(rateString, sizeof(rateString),
                                B_TRANSLATE("%.3f kHz"), sr / 1000);
-                       s << rateString;
+                       info << rateString;
                } else {
                        BString rateString = B_TRANSLATE("%d kHz");
                        rateString.ReplaceFirst("%d", "??");
-                       s << rateString;
+                       info << rateString;
                }
                if (format.type == B_MEDIA_ENCODED_AUDIO) {
                        float br = format.u.encoded_audio.bit_rate;
                        char string[20] = "";
                        if (br > 0.0)
-                               s << ", " << string_for_rate(br, string, 
sizeof(string));
+                               info << ", " << string_for_rate(br, string, 
sizeof(string));
                }
-               s << "\n\n";
-               fContentsView->Insert(s.String());
+
+               fAudioConfigInfo->SetText(info.String());
        }
 
-       // statistics
-       if ((which & INFO_STATS) && fController->HasFile()) {
-               BString label = B_TRANSLATE("Duration");
-               fLabelsView->Insert(label << "\n");
-               BString s;
-               bigtime_t d = fController->TimeDuration();
-               bigtime_t v;
-
-               //s << d << "µs; ";
-
-               d /= 1000;
-
-               v = d / (3600 * 1000);
-               d = d % (3600 * 1000);
-               bool hours = v > 0;
-               if (hours)
-                       s << v << ":";
-               v = d / (60 * 1000);
-               d = d % (60 * 1000);
-               s << v << ":";
-               v = d / 1000;
-               if (v < 10)
-                       s << '0';
-               s << v;
-               if (hours)
-                       s << " " << B_TRANSLATE_COMMENT("h", "Hours");
-               else
-                       s << " " << B_TRANSLATE_COMMENT("min", "Minutes");
-               s << "\n";
-               fContentsView->Insert(s.String());
-               // TODO: demux/video/audio/... perfs (Kb/s)
-
-               BString content = B_TRANSLATE("Display mode");
-               fLabelsView->Insert(content << "\n");
-               if (fController->IsOverlayActive()) {
-                       content = B_TRANSLATE("Overlay");
-                       fContentsView->Insert(content << "\n");
-               } else {
-                       content = B_TRANSLATE("DrawBitmap");
-                       fContentsView->Insert(content << "\n");
-               }
+       fAudioSeparator->SetVisible(visible);
+       _SetVisible(fAudioLabel, visible);
+       _SetVisible(fAudioFormatInfo, visible);
+       _SetVisible(fAudioConfigInfo, visible);
+}
 
-               fLabelsView->Insert("\n");
-               fContentsView->Insert("\n");
-       }
 
-       if (which & INFO_TRANSPORT) {
-               // Transport protocol info (file, http, rtsp, ...)
+void
+InfoWin::_UpdateDuration()
+{
+       if (!fController->HasFile()) {
+               fDurationInfo->SetText("-");
+               return;
        }
 
-       if (which & INFO_FILE) {
-               bool iconSet = false;
-               if (fController->HasFile()) {
-                       const PlaylistItem* item = fController->Item();
-                       iconSet = fInfoView->SetIcon(item) == B_OK;
-                       media_file_format fileFormat;
-                       BString s;
-                       if (fController->GetFileFormatInfo(&fileFormat) == 
B_OK) {
-                               BString label = B_TRANSLATE("Container");
-                               fLabelsView->Insert(label << "\n");
-                               s << fileFormat.pretty_name;
-                               s << "\n";
-                               fContentsView->Insert(s.String());
-                               if (!iconSet)
-                                       iconSet = 
fInfoView->SetIcon(fileFormat.mime_type) == B_OK;
-                       } else
-                               fContentsView->Insert("\n");
-                       BString label = B_TRANSLATE("Location");
-                       fLabelsView->Insert(label << "\n");
-                       if (fController->GetLocation(&s) < B_OK)
-                               s = B_TRANSLATE("<unknown>");
-                       s << "\n";
-                       fContentsView->Insert(s.String());
-                       if (fController->GetName(&s) < B_OK)
-                               s = B_TRANSLATE("<unnamed media>");
-                       fFilenameView->SetText(s.String());
-               } else {
-                       fFilenameView->SetText(B_TRANSLATE("<no media>"));
-               }
-               if (!iconSet)
-                       fInfoView->SetGenericIcon();
-       }
+       BString info;
+
+       bigtime_t d = fController->TimeDuration() / 1000;
+       bigtime_t v = d / (3600 * 1000);
+       d = d % (3600 * 1000);
+       bool hours = v > 0;
+       if (hours)
+               info << v << ":";
+       v = d / (60 * 1000);
+       d = d % (60 * 1000);
+       info << v << ":";
+       v = d / 1000;
+       if (v < 10)
+               info << '0';
+       info << v;
+       if (hours)
+               info << " " << B_TRANSLATE_COMMENT("h", "Hours");
+       else
+               info << " " << B_TRANSLATE_COMMENT("min", "Minutes");
+
+       fDurationInfo->SetText(info.String());
+}
 
-       if ((which & INFO_COPYRIGHT) && fController->HasFile()) {
-               BString s;
-               if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) {
-                       BString label = B_TRANSLATE("Copyright");
-                       fLabelsView->Insert(label << "\n\n");
-                       s << "\n\n";
-                       fContentsView->Insert(s.String());
-               }
-       }
 
-       fController->Unlock();
+void
+InfoWin::_UpdateCopyright()
+{
+       BString info;
 
-       ResizeToPreferred();
+       bool visible = fController->HasFile()
+               && fController->GetCopyright(&info) == B_OK && !info.IsEmpty();
+       if (visible)
+               fCopyrightInfo->SetText(info.String());
+
+       fCopyrightSeparator->SetVisible(visible);
+       _SetVisible(fCopyrightLabel, visible);
+       _SetVisible(fCopyrightInfo, visible);
+}
+
+
+// #pragma mark -
+
+
+BStringView*
+InfoWin::_CreateLabel(const char* name, const char* label)
+{
+       static const rgb_color kLabelColor = tint_color(
+               ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT);
+
+       BStringView* view = new BStringView(name, label);
+       view->SetAlignment(B_ALIGN_RIGHT);
+       view->SetHighColor(kLabelColor);
+
+       return view;
+}
+
+
+BStringView*
+InfoWin::_CreateInfo(const char* name)
+{
+       BStringView* view = new BStringView(name, "");
+       view->SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
+       view->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
+       view->SetTruncation(B_TRUNCATE_SMART);
+
+       return view;
+}
+
+
+BLayoutItem*
+InfoWin::_CreateSeparator()
+{
+       return BSpaceLayoutItem::CreateVerticalStrut(
+               be_control_look->ComposeSpacing(B_USE_HALF_ITEM_SPACING));
+}
+
+
+void
+InfoWin::_SetVisible(BView* view, bool visible)
+{
+       bool hidden = view->IsHidden(view);
+       if (hidden && visible)
+               view->Show();
+       else if (!hidden && !visible)
+               view->Hide();
 }
diff --git a/src/apps/mediaplayer/InfoWin.h b/src/apps/mediaplayer/InfoWin.h
index 819b892..1cd72fb 100644
--- a/src/apps/mediaplayer/InfoWin.h
+++ b/src/apps/mediaplayer/InfoWin.h
@@ -24,11 +24,12 @@
 #include <Window.h>
 
 
+class BLayoutItem;
 class BStringView;
 class BTextView;
 class Controller;
 class ControllerObserver;
-class InfoView;
+class IconView;
 
 
 #define INFO_STATS             0x00000001
@@ -47,22 +48,49 @@ public:
                                                                        
Controller* controller);
        virtual                                         ~InfoWin();
 
-       virtual void                            FrameResized(float newWidth, 
float newHeight);
        virtual void                            MessageReceived(BMessage* 
message);
        virtual bool                            QuitRequested();
        virtual void                            Pulse();
 
-                       void                            ResizeToPreferred();
                        void                            Update(uint32 which = 
INFO_ALL);
 
 private:
+                       void                            _UpdateFile();
+                       void                            _UpdateVideo();
+                       void                            _UpdateAudio();
+                       void                            _UpdateDuration();
+                       void                            _UpdateCopyright();
+
+                       BStringView*            _CreateLabel(const char* name,
+                                                                       const 
char* label);
+                       BStringView*            _CreateInfo(const char* name);
+                       BLayoutItem*            _CreateSeparator();
+                       void                            _SetVisible(BView* 
view, bool visible);
+
+private:
                        Controller*                     fController;
                        ControllerObserver*     fControllerObserver;
 
-                       InfoView*                       fInfoView;
+                       IconView*                       fIconView;
                        BStringView*            fFilenameView;
-                       BTextView*                      fLabelsView;
-                       BTextView*                      fContentsView;
+
+                       BStringView*            fContainerInfo;
+                       BLayoutItem*            fVideoSeparator;
+                       BStringView*            fVideoLabel;
+                       BStringView*            fVideoFormatInfo;
+                       BStringView*            fVideoConfigInfo;
+                       BStringView*            fDisplayModeLabel;
+                       BStringView*            fDisplayModeInfo;
+                       BLayoutItem*            fAudioSeparator;
+                       BStringView*            fAudioLabel;
+                       BStringView*            fAudioFormatInfo;
+                       BStringView*            fAudioConfigInfo;
+                       BStringView*            fDurationInfo;
+                       BStringView*            fLocationInfo;
+                       BLayoutItem*            fCopyrightSeparator;
+                       BStringView*            fCopyrightLabel;
+                       BStringView*            fCopyrightInfo;
 };
 
+
 #endif // __FILE_INFO_WIN_H

############################################################################

Commit:      ddf7ecfaa91f2a1b20d596b85133d94548b0624b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ddf7ecfaa91f
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 09:50:09 2015 UTC

E-mail: take fCheckMailCheckBox into account on save.

* Only the time you entered mattered (ie. 0 would have turned
  the auto check off).

----------------------------------------------------------------------------

diff --git a/src/preferences/mail/ConfigWindow.cpp 
b/src/preferences/mail/ConfigWindow.cpp
index 20c1411..47ef076 100644
--- a/src/preferences/mail/ConfigWindow.cpp
+++ b/src/preferences/mail/ConfigWindow.cpp
@@ -445,10 +445,13 @@ ConfigWindow::_SaveSettings()
 
        BMailSettings settings;
        if (fSaveSettings) {
-               // figure out time interval
-               float floatInterval;
-               sscanf(fIntervalControl->Text(), "%f", &floatInterval);
-               bigtime_t interval = bigtime_t(60000000L * floatInterval);
+               bigtime_t interval = 0;
+               if (fCheckMailCheckBox->Value() == B_CONTROL_ON) {
+                       // figure out time interval
+                       float floatInterval;
+                       sscanf(fIntervalControl->Text(), "%f", &floatInterval);
+                       interval = bigtime_t(60000000L * floatInterval);
+               }
 
                settings.SetAutoCheckInterval(interval);
                settings.SetDaemonAutoStarts(!fAccounts.IsEmpty());

############################################################################

Commit:      be9609b91c7e3c8288d2285cd80e5694f7c8f085
URL:         http://cgit.haiku-os.org/haiku/commit/?id=be9609b91c7e
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 16:07:54 2015 UTC

Mouse: made the shadow an actual shadow.

----------------------------------------------------------------------------

diff --git a/src/preferences/mouse/MouseView.cpp 
b/src/preferences/mouse/MouseView.cpp
index 78c8edd..225328b 100644
--- a/src/preferences/mouse/MouseView.cpp
+++ b/src/preferences/mouse/MouseView.cpp
@@ -32,6 +32,7 @@
 #include "MouseSettings.h"
 #include "MouseWindow.h"
 
+
 static const int32 kButtonTop = 6;
 static const int32 kMouseDownWidth = 72;
 static const int32 kMouseDownHeight = 30;
@@ -44,11 +45,12 @@ static const int32 kThreeButtonOffsets[4]
        = { 0, kMouseDownWidth / 3, kMouseDownWidth / 3 * 2, kMouseDownWidth };
 
 static const rgb_color kButtonTextColor = { 0, 0, 0, 255 };
-static const rgb_color kMouseShadowColor = { 150, 150, 150, 255 };
-static const rgb_color kMouseBodyTopColor = { 0xed, 0xed, 0xed, 255};
+static const rgb_color kMouseShadowColor = { 100, 100, 100, 128 };
+static const rgb_color kMouseBodyTopColor = { 0xed, 0xed, 0xed, 255 };
 static const rgb_color kMouseBodyBottomColor = { 0x85, 0x85, 0x85, 255 };
 static const rgb_color kMouseOutlineColor = { 0x51, 0x51, 0x51, 255 };
 
+
 static const int32*
 getButtonOffsets(int32 type)
 {
@@ -102,10 +104,10 @@ MouseView::~MouseView()
 void
 MouseView::GetPreferredSize(float* _width, float* _height)
 {
-       if (_width)
+       if (_width != NULL)
                *_width = kMouseDownWidth + 2;
-       if (_height)
-               *_height = 100;
+       if (_height != NULL)
+               *_height = 104;
 }
 
 

############################################################################

Commit:      637cd3124e65091beca6bb673fe713730cedb724
URL:         http://cgit.haiku-os.org/haiku/commit/?id=637cd3124e65
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 16:10:27 2015 UTC

Mouse: slightly improved the look of the mouse.

* Made it a bit longer, and let the button outline stand out less.

----------------------------------------------------------------------------

diff --git a/src/preferences/mouse/MouseView.cpp 
b/src/preferences/mouse/MouseView.cpp
index 225328b..c15080d 100644
--- a/src/preferences/mouse/MouseView.cpp
+++ b/src/preferences/mouse/MouseView.cpp
@@ -42,13 +42,14 @@ static const int32 kOneButtonOffsets[4]
 static const int32 kTwoButtonOffsets[4]
        = { 0, kMouseDownWidth / 2, kMouseDownWidth };
 static const int32 kThreeButtonOffsets[4]
-       = { 0, kMouseDownWidth / 3, kMouseDownWidth / 3 * 2, kMouseDownWidth };
+       = { 5, kMouseDownWidth / 3, kMouseDownWidth / 3 * 2, kMouseDownWidth - 
4 };
 
 static const rgb_color kButtonTextColor = { 0, 0, 0, 255 };
 static const rgb_color kMouseShadowColor = { 100, 100, 100, 128 };
 static const rgb_color kMouseBodyTopColor = { 0xed, 0xed, 0xed, 255 };
 static const rgb_color kMouseBodyBottomColor = { 0x85, 0x85, 0x85, 255 };
 static const rgb_color kMouseOutlineColor = { 0x51, 0x51, 0x51, 255 };
+static const rgb_color kMouseButtonOutlineColor = { 0xa0, 0xa0, 0xa0, 255 };
 
 
 static const int32*
@@ -204,9 +205,9 @@ MouseView::Draw(BRect updateFrame)
 
        BShape mouseShape;
        mouseShape.MoveTo(BPoint(16, 12));
-       BPoint control[3] = { BPoint(12, 16), BPoint(8, 60), BPoint(32, 60) };
+       BPoint control[3] = { BPoint(12, 16), BPoint(8, 64), BPoint(32, 64) };
        mouseShape.BezierTo(control);
-       BPoint control2[3] = { BPoint(56, 60), BPoint(52, 16), BPoint(48, 12) };
+       BPoint control2[3] = { BPoint(56, 64), BPoint(52, 16), BPoint(48, 12) };
        mouseShape.BezierTo(control2);
        BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
        mouseShape.BezierTo(control3);
@@ -248,6 +249,7 @@ MouseView::Draw(BRect updateFrame)
                buttonsOutline.LineTo(BPoint(32, 9));
        }
 
+       SetHighColor(kMouseButtonOutlineColor);
        StrokeShape(&buttonsOutline, B_SOLID_HIGH);
 
        mouse_map map;

############################################################################

Commit:      9b2f5619083cbf9e4142158a277bdf09413b5dda
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9b2f5619083c
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 16:29:22 2015 UTC

Mouse: minor cleanup.

* Removed no longer used class members.
* Synchronized implementation and declaration order.

----------------------------------------------------------------------------

diff --git a/src/preferences/mouse/MouseView.cpp 
b/src/preferences/mouse/MouseView.cpp
index c15080d..60b9c4b 100644
--- a/src/preferences/mouse/MouseView.cpp
+++ b/src/preferences/mouse/MouseView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
+ * Copyright 2003-2015 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -103,6 +103,28 @@ MouseView::~MouseView()
 
 
 void
+MouseView::SetMouseType(int32 type)
+{
+       fType = type;
+       Invalidate();
+}
+
+
+void
+MouseView::MouseMapUpdated()
+{
+       Invalidate();
+}
+
+
+void
+MouseView::UpdateFromSettings()
+{
+       SetMouseType(fSettings.MouseType());
+}
+
+
+void
 MouseView::GetPreferredSize(float* _width, float* _height)
 {
        if (_width != NULL)
@@ -113,6 +135,18 @@ MouseView::GetPreferredSize(float* _width, float* _height)
 
 
 void
+MouseView::AttachedToWindow()
+{
+       if (Parent() != NULL)
+               SetViewColor(Parent()->ViewColor());
+       else
+               SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+
+       UpdateFromSettings();
+}
+
+
+void
 MouseView::MouseUp(BPoint)
 {
        fButtons = 0;
@@ -184,18 +218,6 @@ MouseView::MouseDown(BPoint where)
 
 
 void
-MouseView::AttachedToWindow()
-{
-       if (Parent() != NULL)
-               SetViewColor(Parent()->ViewColor());
-       else
-               SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
-
-       UpdateFromSettings();
-}
-
-
-void
 MouseView::Draw(BRect updateFrame)
 {
        SetDrawingMode(B_OP_ALPHA);
@@ -300,26 +322,3 @@ MouseView::_ConvertFromVisualOrder(int32 i)
                        return 1;
        }
 }
-
-
-void
-MouseView::SetMouseType(int32 type)
-{
-       fType = type;
-       Invalidate();
-}
-
-
-void
-MouseView::MouseMapUpdated()
-{
-       Invalidate();
-}
-
-
-void
-MouseView::UpdateFromSettings()
-{
-       SetMouseType(fSettings.MouseType());
-}
-
diff --git a/src/preferences/mouse/MouseView.h 
b/src/preferences/mouse/MouseView.h
index fb7c814..5c86525 100644
--- a/src/preferences/mouse/MouseView.h
+++ b/src/preferences/mouse/MouseView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
+ * Copyright 2003-2015 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -20,31 +20,31 @@ class MouseSettings;
 
 class MouseView : public BView {
 public:
-                                                               MouseView(const 
MouseSettings &settings);
+                                                               MouseView(const 
MouseSettings& settings);
                virtual                                 ~MouseView();
 
-               virtual void                    AttachedToWindow();
-               virtual void                    MouseDown(BPoint where);
-               virtual void                    MouseUp(BPoint where);
-               virtual void                    Draw(BRect frame);
-               virtual void                    GetPreferredSize(float *_width, 
float *_height);
-
                                void                    SetMouseType(int32 
type);
                                void                    MouseMapUpdated();
                                void                    UpdateFromSettings();
 
+               virtual void                    GetPreferredSize(float* _width, 
float* _height);
+               virtual void                    AttachedToWindow();
+               virtual void                    MouseUp(BPoint where);
+               virtual void                    MouseDown(BPoint where);
+               virtual void                    Draw(BRect frame);
+
 private:
-               int32 _ConvertFromVisualOrder(int32 button);
+                               int32                   
_ConvertFromVisualOrder(int32 button);
 
-                               typedef                 BView inherited;
+private:
+       typedef BView inherited;
 
-               const   MouseSettings   &fSettings;
-                               BBitmap                 *fMouseBitmap, 
*fMouseDownBitmap;
-                               BRect                   fMouseDownBounds;
+               const   MouseSettings&  fSettings;
 
                                int32                   fType;
                                uint32                  fButtons;
                                uint32                  fOldButtons;
 };
 
+
 #endif /* MOUSE_VIEW_H */

############################################################################

Commit:      27231d807a1b3a179b8456630fb4b16a24dd701c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=27231d807a1b
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 21 16:48:59 2015 UTC

ActivityMonitor: changed full legend width behavior.

* Only use the full width if there is only a single item, otherwise
  I think it's more confusing than helpful.

----------------------------------------------------------------------------

diff --git a/src/apps/activitymonitor/ActivityView.cpp 
b/src/apps/activitymonitor/ActivityView.cpp
index 10cdc1c..2e9a405 100644
--- a/src/apps/activitymonitor/ActivityView.cpp
+++ b/src/apps/activitymonitor/ActivityView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx.
+ * Copyright 2008-2015, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -1272,8 +1272,8 @@ ActivityView::_LegendFrameAt(BRect frame, int32 index) 
const
        int32 column = index & 1;
        int32 row = index / 2;
        if (column == 0) {
-               // The last item, if it is on the first column, can use the 
full width.
-               if (index < fSources.CountItems() - 1)
+               // Use the full width if there is only one item
+               if (fSources.CountItems() != 1)
                        frame.right = frame.left + floorf(frame.Width() / 2) - 
5;
        } else
                frame.left = frame.right - floorf(frame.Width() / 2) + 5;

############################################################################

Revision:    hrev48714
Commit:      86f6a66bbe1c03bb92aabffbb3e6b7e5144bb78f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=86f6a66bbe1c
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Fri Jan 23 19:54:41 2015 UTC

Mouse: make the buttons actually look pressed.

* Just making the font bold looks ugly, lazy Adrien :-)

----------------------------------------------------------------------------

diff --git a/src/preferences/mouse/MouseView.cpp 
b/src/preferences/mouse/MouseView.cpp
index 60b9c4b..8cae6f2 100644
--- a/src/preferences/mouse/MouseView.cpp
+++ b/src/preferences/mouse/MouseView.cpp
@@ -33,16 +33,16 @@
 #include "MouseWindow.h"
 
 
-static const int32 kButtonTop = 6;
+static const int32 kButtonTop = 3;
 static const int32 kMouseDownWidth = 72;
-static const int32 kMouseDownHeight = 30;
+static const int32 kMouseDownHeight = 35;
 
 static const int32 kOneButtonOffsets[4]
        = { 0, kMouseDownWidth };
 static const int32 kTwoButtonOffsets[4]
        = { 0, kMouseDownWidth / 2, kMouseDownWidth };
 static const int32 kThreeButtonOffsets[4]
-       = { 5, kMouseDownWidth / 3, kMouseDownWidth / 3 * 2, kMouseDownWidth - 
4 };
+       = { 0, kMouseDownWidth / 3 + 1, kMouseDownWidth / 3 * 2, 
kMouseDownWidth };
 
 static const rgb_color kButtonTextColor = { 0, 0, 0, 255 };
 static const rgb_color kMouseShadowColor = { 100, 100, 100, 128 };
@@ -50,6 +50,7 @@ static const rgb_color kMouseBodyTopColor = { 0xed, 0xed, 
0xed, 255 };
 static const rgb_color kMouseBodyBottomColor = { 0x85, 0x85, 0x85, 255 };
 static const rgb_color kMouseOutlineColor = { 0x51, 0x51, 0x51, 255 };
 static const rgb_color kMouseButtonOutlineColor = { 0xa0, 0xa0, 0xa0, 255 };
+static const rgb_color kButtonPressedColor = { 110, 110, 110, 110 };
 
 
 static const int32*
@@ -143,6 +144,12 @@ MouseView::AttachedToWindow()
                SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 
        UpdateFromSettings();
+       _CreateButtonsPicture();
+
+       font_height fontHeight;
+       GetFontHeight(&fontHeight);
+       fDigitHeight = int32(ceilf(fontHeight.ascent) + 
ceilf(fontHeight.descent));
+       fDigitBaseline = int32(ceilf(fontHeight.ascent));
 }
 
 
@@ -223,14 +230,16 @@ MouseView::Draw(BRect updateFrame)
        SetDrawingMode(B_OP_ALPHA);
        SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
        SetScale(1.8);
-       SetOrigin(-21, -14);
 
        BShape mouseShape;
        mouseShape.MoveTo(BPoint(16, 12));
+       // left
        BPoint control[3] = { BPoint(12, 16), BPoint(8, 64), BPoint(32, 64) };
        mouseShape.BezierTo(control);
+       // right
        BPoint control2[3] = { BPoint(56, 64), BPoint(52, 16), BPoint(48, 12) };
        mouseShape.BezierTo(control2);
+       // top
        BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
        mouseShape.BezierTo(control3);
        mouseShape.Close();
@@ -255,54 +264,66 @@ MouseView::Draw(BRect updateFrame)
 
        StrokeShape(&mouseShape, B_SOLID_HIGH);
 
+       // bottom button border
        BShape buttonsOutline;
        buttonsOutline.MoveTo(BPoint(13, 27));
        BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) };
        buttonsOutline.BezierTo(control4);
 
-       // Separator between the buttons
-       if (fType == 3) {
-               buttonsOutline.MoveTo(BPoint(26, 29));
-               buttonsOutline.LineTo(BPoint(26, 9));
-               buttonsOutline.MoveTo(BPoint(38, 29));
-               buttonsOutline.LineTo(BPoint(38, 9));
-       } else if (fType == 2) {
-               buttonsOutline.MoveTo(BPoint(32, 29));
-               buttonsOutline.LineTo(BPoint(32, 9));
-       }
-
        SetHighColor(kMouseButtonOutlineColor);
        StrokeShape(&buttonsOutline, B_SOLID_HIGH);
 
-       mouse_map map;
-       fSettings.Mapping(map);
+       SetScale(1);
+       SetOrigin(0, 0);
 
+       // Separator between the buttons
        const int32* offset = getButtonOffsets(fType);
-//     bool middlePressed = fType == 3 && (map.button[2] & fButtons) != 0;
+       for (int32 i = 1; i < fType; i++) {
+               StrokeLine(BPoint(offset[i], kButtonTop),
+                       BPoint(offset[i], kButtonTop + kMouseDownHeight));
+       }
+
+       mouse_map map;
+       fSettings.Mapping(map);
 
-       SetHighColor(kButtonTextColor);
        SetDrawingMode(B_OP_OVER);
-       SetScale(1);
-       SetOrigin(0, 0);
+
+       if (fButtons != 0)
+               ClipToPicture(&fButtonsPicture, B_ORIGIN, false);
 
        for (int32 i = 0; i < fType; i++) {
                // draw mapping number centered over the button
 
                bool pressed = (fButtons & 
map.button[_ConvertFromVisualOrder(i)]) != 0;
                        // is button currently pressed?
+               if (pressed) {
+                       SetDrawingMode(B_OP_ALPHA);
+                       SetHighColor(kButtonPressedColor);
+                       FillRect(BRect(offset[i], kButtonTop, offset[i + 1] - 1,
+                               kButtonTop + kMouseDownHeight));
+               }
 
-               SetFont(pressed ? be_bold_font : be_plain_font);
-
-               BRect border(offset[i] + 1, kButtonTop + 2, offset[i + 1] - 1,
+               BRect border(offset[i] + 1, kButtonTop + 5, offset[i + 1] - 1,
                        kButtonTop + kMouseDownHeight - 4);
+               if (i == 0)
+                       border.left += 5;
+               if (i == fType - 1)
+                       border.right -= 4;
 
                char number[2] = {0};
                number[0] = 
getMappingNumber(map.button[_ConvertFromVisualOrder(i)])
                        + '1';
 
-               DrawString(number, BPoint(border.left +
-                       (border.Width() - StringWidth(number)) / 2, kButtonTop 
+ 18));
+               SetDrawingMode(B_OP_OVER);
+               SetHighColor(kButtonTextColor);
+               DrawString(number, BPoint(
+                       border.left + (border.Width() - StringWidth(number)) / 
2,
+                       border.top + fDigitBaseline
+                               + (border.IntegerHeight() - fDigitHeight) / 2));
        }
+
+       if (fButtons != 0)
+               ClipToPicture(NULL);
 }
 
 
@@ -322,3 +343,35 @@ MouseView::_ConvertFromVisualOrder(int32 i)
                        return 1;
        }
 }
+
+
+void
+MouseView::_CreateButtonsPicture()
+{
+       BeginPicture(&fButtonsPicture);
+       SetScale(1.8);
+       SetOrigin(-21, -14);
+
+       BShape mouseShape;
+       mouseShape.MoveTo(BPoint(48, 12));
+       // top
+       BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
+       mouseShape.BezierTo(control3);
+       // left
+       BPoint control[3] = { BPoint(12, 16), BPoint(13, 27), BPoint(13, 27) };
+       mouseShape.BezierTo(control);
+       // bottom
+       BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) };
+       mouseShape.BezierTo(control4);
+       // right
+       BPoint control2[3] = { BPoint(51, 27), BPoint(50, 14), BPoint(48, 12) };
+       mouseShape.BezierTo(control2);
+
+       mouseShape.Close();
+
+       SetHighColor(255, 0, 0, 255);
+       FillShape(&mouseShape, B_SOLID_HIGH);
+
+       EndPicture();
+       SetScale(1);
+}
diff --git a/src/preferences/mouse/MouseView.h 
b/src/preferences/mouse/MouseView.h
index 5c86525..e6238cb 100644
--- a/src/preferences/mouse/MouseView.h
+++ b/src/preferences/mouse/MouseView.h
@@ -12,6 +12,7 @@
 
 
 #include <Bitmap.h>
+#include <Picture.h>
 #include <PopUpMenu.h>
 #include <View.h>
 
@@ -35,12 +36,17 @@ public:
 
 private:
                                int32                   
_ConvertFromVisualOrder(int32 button);
+                               void                    _CreateButtonsPicture();
 
 private:
        typedef BView inherited;
 
                const   MouseSettings&  fSettings;
 
+                               BPicture                fButtonsPicture;
+                               int32                   fDigitBaseline;
+                               int32                   fDigitHeight;
+
                                int32                   fType;
                                uint32                  fButtons;
                                uint32                  fOldButtons;


Other related posts: