In media preferences:

* remove custom 'BarView' class, and replace it with BSeparatorView.
* remove BStringVIew for displaying titles, our BSeparatorView does this now.
* Have the BSeparatorView always draw, BarView was only drawn sometimes.

This helps stabilise the window size, cleans up the code and looks nicer, in my opinion.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alex Wilson 2010-10-22 21:02:46 +00:00
parent 5a0d2097fe
commit 7c4e83dd1f
4 changed files with 9 additions and 57 deletions

View File

@ -38,33 +38,6 @@
#define B_TRANSLATE_CONTEXT "Media views"
BarView::BarView()
:
BView("barView", B_WILL_DRAW ),
fDisplay(true)
{
}
void
BarView::Draw(BRect updateRect)
{
BRect r = Bounds();
if (fDisplay) {
// Display the 3D Look Divider Bar
SetHighColor(140,140,140,0);
StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top));
SetHighColor(255,255,255,0);
StrokeLine(BPoint(r.left,r.bottom),BPoint(r.right,r.bottom));
} else {
SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top));
StrokeLine(BPoint(r.left,r.bottom),BPoint(r.right,r.bottom));
}
}
SettingsView::SettingsView (bool isVideo)
:
BView("SettingsView", B_WILL_DRAW | B_SUPPORTS_LAYOUT),

View File

@ -30,16 +30,6 @@ const uint32 ML_DEFAULT_CHANGE = 'dech';
const uint32 ML_DEFAULTOUTPUT_CHANGE = 'doch';
class BarView : public BView
{
public:
BarView();
virtual void Draw(BRect updateRect);
bool fDisplay;
};
class SettingsItem : public BMenuItem
{
public:

View File

@ -26,6 +26,7 @@
#include <Roster.h>
#include <Screen.h>
#include <ScrollView.h>
#include <SeparatorView.h>
#include <SpaceLayoutItem.h>
#include <StorageKit.h>
#include <String.h>
@ -203,11 +204,9 @@ MediaWindow::InitWindow(void)
GetLayout()->AddView(fBox);
// StringViews
rgb_color titleFontColor = { 0, 0, 0, 0 };
fTitleView = new BStringView("AudioSettings",
B_TRANSLATE("Audio settings"), B_WILL_DRAW);
fTitleView = new BSeparatorView(B_HORIZONTAL, B_FANCY_BORDER);
fTitleView->SetLabel(B_TRANSLATE("Audio settings"));
fTitleView->SetFont(be_bold_font);
fTitleView->SetHighColor(titleFontColor);
fContentView = new BBox("contentView", B_WILL_DRAW | B_FRAME_EVENTS,
B_NO_BORDER);
@ -215,16 +214,11 @@ MediaWindow::InitWindow(void)
fAudioView = new SettingsView(false);
fVideoView = new SettingsView(true);
fBar = new BarView();
BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL);
titleGroupView->GroupLayout()->AddView(fTitleView);
titleGroupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
// Layout all views
BGroupView* rightView = new BGroupView(B_VERTICAL, 5);
rightView->GroupLayout()->SetInsets(14, 0, 0, 0);
rightView->GroupLayout()->AddView(titleGroupView);
rightView->GroupLayout()->AddView(fBar, 0);
rightView->GroupLayout()->AddView(fTitleView);
rightView->GroupLayout()->AddView(fContentView);
BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL);
@ -602,7 +596,7 @@ MediaWindow::MessageReceived(BMessage* message)
delete fParamWeb;
fParamWeb = NULL;
fTitleView->SetText(item->GetLabel());
fTitleView->SetLabel(item->GetLabel());
if (item->OutlineLevel() == 0) {
if (item->IsVideo())
@ -641,13 +635,6 @@ MediaWindow::MessageReceived(BMessage* message)
(bounds.Height()-stringView->Bounds().Height())/2);
}
}
bool barChanged = (item->OutlineLevel() == 0
|| fParamWeb == NULL || fParamWeb->CountGroups()<2);
if (barChanged != fBar->fDisplay) {
fBar->fDisplay = barChanged;
fBar->Invalidate();
}
}
break;
case B_SOME_APP_LAUNCHED:

View File

@ -31,6 +31,9 @@
#define SETTINGS_FILE "MediaPrefs Settings"
class BSeparatorView;
class MediaWindow : public BWindow
{
public:
@ -57,11 +60,10 @@ private:
BBox* fBox;
BListView* fListView;
BStringView* fTitleView;
BSeparatorView* fTitleView;
BView* fContentView;
SettingsView* fAudioView;
SettingsView* fVideoView;
BarView* fBar;
media_node* fCurrentNode;
BParameterWeb* fParamWeb;