'Sounds' is now font sensitive. Patch by Lucasz Zemczak.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21185 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-05-21 07:22:17 +00:00
parent f1bbbce435
commit 8184808c5f
2 changed files with 38 additions and 22 deletions
+7 -5
View File
@@ -65,12 +65,11 @@ void
HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete) HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete)
{ {
rgb_color kBlack = { 0,0,0,0 }; rgb_color kBlack = { 0,0,0,0 };
rgb_color kHighlight = { 206,207,206,0 };
if (IsSelected() || complete) { if (IsSelected() || complete) {
rgb_color color; rgb_color color;
if (IsSelected()) if (IsSelected())
color = kHighlight; color = tint_color(owner->LowColor(), B_DARKEN_2_TINT);
else else
color = owner->ViewColor(); color = owner->ViewColor();
@@ -79,18 +78,21 @@ HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->FillRect(itemRect); owner->FillRect(itemRect);
owner->SetHighColor(kBlack); owner->SetHighColor(kBlack);
} else { }
else {
owner->SetLowColor(owner->ViewColor()); owner->SetLowColor(owner->ViewColor());
} }
BPoint point = itemRect.LeftTop() + BPoint(5, 10); font_height fontHeight;
be_plain_font->GetHeight(&fontHeight);
BPoint point = itemRect.LeftTop() + BPoint(5, fontHeight.ascent);
owner->SetHighColor(kBlack); owner->SetHighColor(kBlack);
owner->SetFont(be_plain_font); owner->SetFont(be_plain_font);
owner->MovePenTo(point); owner->MovePenTo(point);
owner->DrawString(Name()); owner->DrawString(Name());
point += BPoint(100, 0); point += BPoint(120, 0);
BPath path(Path()); BPath path(Path());
owner->MovePenTo(point); owner->MovePenTo(point);
owner->DrawString(path.Leaf() ? path.Leaf() : "<none>"); owner->DrawString(path.Leaf() ? path.Leaf() : "<none>");
+31 -17
View File
@@ -74,19 +74,21 @@ HWindow::InitGUI()
{ {
BRect rect = Bounds(); BRect rect = Bounds();
rect.bottom -= 106; rect.bottom -= 106;
BView *view = new BView(rect,"",B_FOLLOW_ALL, B_WILL_DRAW|B_PULSE_NEEDED); BView *listView = new BView(rect,"",B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view); AddChild(listView);
BRect stringRect(16, 5, 60, 22); BRect stringRect(16, 5, 60, 22);
BStringView *stringView = new BStringView(stringRect, "event", "Event"); BStringView *stringView = new BStringView(stringRect, "event", "Event");
stringView->SetFont(be_bold_font); stringView->SetFont(be_bold_font);
view->AddChild(stringView); stringView->ResizeToPreferred();
listView->AddChild(stringView);
stringRect.OffsetBy(100, 0); stringRect.OffsetBy(120, 0);
stringView = new BStringView(stringRect, "sound", "Sound"); stringView = new BStringView(stringRect, "sound", "Sound");
stringView->SetFont(be_bold_font); stringView->SetFont(be_bold_font);
view->AddChild(stringView); stringView->ResizeToPreferred();
listView->AddChild(stringView);
rect.left += 13; rect.left += 13;
rect.right -= B_V_SCROLL_BAR_WIDTH + 13; rect.right -= B_V_SCROLL_BAR_WIDTH + 13;
@@ -101,11 +103,11 @@ HWindow::InitGUI()
,0 ,0
,false ,false
,true); ,true);
view->AddChild(scrollView); listView->AddChild(scrollView);
rect = Bounds(); rect = Bounds();
rect.top = rect.bottom - 105; rect.top = rect.bottom - 105;
view = new BView(rect,"",B_FOLLOW_LEFT_RIGHT|B_FOLLOW_BOTTOM,B_WILL_DRAW|B_PULSE_NEEDED); BView *view = new BView(rect,"", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view); AddChild(view);
rect = view->Bounds().InsetBySelf(12, 12); rect = view->Bounds().InsetBySelf(12, 12);
@@ -127,25 +129,37 @@ HWindow::InitGUI()
,"filemenu" ,"filemenu"
,"Sound File:" ,"Sound File:"
,menu ,menu
,B_FOLLOW_TOP|B_FOLLOW_LEFT); ,B_FOLLOW_TOP | B_FOLLOW_LEFT);
menuField->SetDivider(menuField->StringWidth("Sound File:")+10); menuField->SetDivider(menuField->StringWidth("Sound File:") + 10);
box->AddChild(menuField); box->AddChild(menuField);
rect.OffsetBy(-2,38); rect.OffsetBy(-2, menuField->Bounds().Height() + 15);
rect.left = rect.right - 80;
BButton *button = new BButton(rect BButton *button = new BButton(rect
,"stop" ,"stop"
,"Stop" ,"Stop"
,new BMessage(M_STOP_MESSAGE) ,new BMessage(M_STOP_MESSAGE)
,B_FOLLOW_RIGHT|B_FOLLOW_TOP); ,B_FOLLOW_RIGHT | B_FOLLOW_TOP);
button->ResizeToPreferred();
button->MoveTo(box->Bounds().right - button->Bounds().Width() - 15, rect.top);
box->AddChild(button); box->AddChild(button);
rect.OffsetBy(-90,0); rect = button->Frame();
view->ResizeTo(view->Bounds().Width(), 24 + rect.bottom + 12);
box->ResizeTo(box->Bounds().Width(), rect.bottom + 12);
button->SetResizingMode(B_FOLLOW_RIGHT | B_FOLLOW_TOP);
button = new BButton(rect button = new BButton(rect
,"play" ,"play"
,"Play" ,"Play"
,new BMessage(M_PLAY_MESSAGE) ,new BMessage(M_PLAY_MESSAGE)
,B_FOLLOW_RIGHT|B_FOLLOW_TOP); ,B_FOLLOW_RIGHT | B_FOLLOW_TOP);
button->ResizeToPreferred();
button->MoveTo(rect.left - button->Bounds().Width() - 15, rect.top);
box->AddChild(button); box->AddChild(button);
view->MoveTo(0, listView->Frame().bottom);
ResizeTo(Bounds().Width(), listView->Frame().bottom + view->Bounds().Height());
listView->SetResizingMode(B_FOLLOW_ALL);
view->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
// setup file menu // setup file menu
SetupMenuField(); SetupMenuField();