From 768734a83155429a25290bffdefab2fecf0a3762 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Tue, 26 Oct 2010 03:34:17 +0000 Subject: [PATCH] In media preflet, update handling of nodes with no controls to look nicer and not make our window really small. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39149 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/media/MediaWindow.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/preferences/media/MediaWindow.cpp b/src/preferences/media/MediaWindow.cpp index d2e24d5787..6b2f931152 100644 --- a/src/preferences/media/MediaWindow.cpp +++ b/src/preferences/media/MediaWindow.cpp @@ -624,21 +624,30 @@ MediaWindow::MessageReceived(BMessage* message) if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK && (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) { fContentView->AddChild(paramView); - paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10); - + paramView->ResizeTo(1, 1); + // make sure we don't get stuck with a very large + // paramView roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD); } else { delete fParamWeb; fParamWeb = NULL; - BRect bounds = fContentView->Bounds(); - BStringView* stringView = new BStringView(bounds, - "noControls", B_TRANSLATE("This hardware has no controls."), - B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER); - stringView->ResizeToPreferred(); + BStringView* stringView = new BStringView("noControls", + B_TRANSLATE("This hardware has no controls.")); + + BSize unlimited(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED); + stringView->SetExplicitMaxSize(unlimited); + + BAlignment centered(B_ALIGN_HORIZONTAL_CENTER, + B_ALIGN_VERTICAL_CENTER); + stringView->SetExplicitAlignment(centered); + stringView->SetAlignment(B_ALIGN_CENTER); + fContentView->AddChild(stringView); - stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2, - (bounds.Height()-stringView->Bounds().Height())/2); + + rgb_color panel = stringView->LowColor(); + stringView->SetHighColor(tint_color(panel, + B_DISABLED_LABEL_TINT)); } } }