Use a ColumnListView
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28359 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,98 +0,0 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
//
|
|
||||||
// Copyright (c) 2003, OpenBeOS
|
|
||||||
//
|
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
|
||||||
// by the OpenBeOS license.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// File: HEventItem.cpp
|
|
||||||
// Author: Jérôme Duval, Oliver Ruiz Dorantes, Atsushi Takamatsu
|
|
||||||
// Description: Sounds Preferences
|
|
||||||
// Created : November 24, 2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
|
|
||||||
#include "HEventItem.h"
|
|
||||||
#include <View.h>
|
|
||||||
#include <NodeInfo.h>
|
|
||||||
#include <Path.h>
|
|
||||||
#include <MediaFiles.h>
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <Beep.h>
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Constructor
|
|
||||||
***********************************************************/
|
|
||||||
HEventItem::HEventItem(const char* name, const char* path)
|
|
||||||
: BListItem(),
|
|
||||||
fName(name)
|
|
||||||
{
|
|
||||||
SetPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Destructor
|
|
||||||
***********************************************************/
|
|
||||||
HEventItem::~HEventItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Set path
|
|
||||||
***********************************************************/
|
|
||||||
void
|
|
||||||
HEventItem::SetPath(const char* in_path)
|
|
||||||
{
|
|
||||||
fPath = in_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Remove
|
|
||||||
***********************************************************/
|
|
||||||
void
|
|
||||||
HEventItem::Remove(const char *type)
|
|
||||||
{
|
|
||||||
BMediaFiles().RemoveItem(type, Name());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* DrawItem
|
|
||||||
***********************************************************/
|
|
||||||
void
|
|
||||||
HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete)
|
|
||||||
{
|
|
||||||
rgb_color kBlack = { 0,0,0,0 };
|
|
||||||
|
|
||||||
if (IsSelected() || complete) {
|
|
||||||
rgb_color color;
|
|
||||||
if (IsSelected())
|
|
||||||
color = tint_color(owner->LowColor(), B_DARKEN_2_TINT);
|
|
||||||
else
|
|
||||||
color = owner->ViewColor();
|
|
||||||
|
|
||||||
owner->SetHighColor(color);
|
|
||||||
owner->SetLowColor(color);
|
|
||||||
owner->FillRect(itemRect);
|
|
||||||
owner->SetHighColor(kBlack);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
owner->SetLowColor(owner->ViewColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
font_height fontHeight;
|
|
||||||
be_plain_font->GetHeight(&fontHeight);
|
|
||||||
BPoint point = itemRect.LeftTop() + BPoint(5, fontHeight.ascent);
|
|
||||||
|
|
||||||
owner->SetHighColor(kBlack);
|
|
||||||
owner->SetFont(be_plain_font);
|
|
||||||
owner->MovePenTo(point);
|
|
||||||
owner->DrawString(Name());
|
|
||||||
|
|
||||||
point += BPoint(120, 0);
|
|
||||||
BPath path(Path());
|
|
||||||
owner->MovePenTo(point);
|
|
||||||
owner->DrawString(path.Leaf() ? path.Leaf() : "<none>");
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
//
|
|
||||||
// Copyright (c) 2003, OpenBeOS
|
|
||||||
//
|
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
|
||||||
// by the OpenBeOS license.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// File: HEventItem.h, Oliver Ruiz Dorantes, Atsushi Takamatsu
|
|
||||||
// Author: Jérôme Duval
|
|
||||||
// Description: Sounds Preferences
|
|
||||||
// Created : November 24, 2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
|
|
||||||
#ifndef __HEVENTITEM_H__
|
|
||||||
#define __HEVENTITEM_H__
|
|
||||||
|
|
||||||
#include <ListItem.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <Entry.h>
|
|
||||||
|
|
||||||
|
|
||||||
class HEventItem : public BListItem {
|
|
||||||
public:
|
|
||||||
HEventItem(const char* event_name
|
|
||||||
,const char* path);
|
|
||||||
virtual ~HEventItem();
|
|
||||||
virtual void DrawItem(BView *owner, BRect itemRect,
|
|
||||||
bool drawEverything = false);
|
|
||||||
|
|
||||||
const char* Name()const { return fName.String();}
|
|
||||||
const char* Path()const { return fPath.String();}
|
|
||||||
void Remove(const char *type);
|
|
||||||
void SetPath(const char* path);
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fName;
|
|
||||||
BString fPath;
|
|
||||||
float fText_offset;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -1,58 +1,68 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
/*
|
||||||
//
|
* Copyright 2003-2008 Haiku Inc. All rights reserved.
|
||||||
// Copyright (c) 2003, OpenBeOS
|
* Distributed under the terms of the MIT license.
|
||||||
//
|
*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Authors:
|
||||||
// by the OpenBeOS license.
|
* Jérôme Duval
|
||||||
//
|
* Oliver Ruiz Dorantes
|
||||||
//
|
* Atsushi Takamatsu
|
||||||
// File: HEventList.cpp
|
*/
|
||||||
// Author: Jérôme Duval, Oliver Ruiz Dorantes, Atsushi Takamatsu
|
|
||||||
// Description: Sounds Preferences
|
|
||||||
// Created : November 24, 2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
|
|
||||||
#include "HEventList.h"
|
#include "HEventList.h"
|
||||||
#include "HEventItem.h"
|
|
||||||
|
|
||||||
#include "HWindow.h"
|
#include <Alert.h>
|
||||||
#include <Bitmap.h>
|
#include <ColumnTypes.h>
|
||||||
#include <ClassInfo.h>
|
#include <Entry.h>
|
||||||
#include <MediaFiles.h>
|
#include <MediaFiles.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Alert.h>
|
|
||||||
#include <PopUpMenu.h>
|
|
||||||
#include <MenuField.h>
|
|
||||||
#include <MenuItem.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Mime.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
#include <NodeInfo.h>
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Constructor
|
HEventRow::HEventRow(const char* name, const char* path)
|
||||||
***********************************************************/
|
: BRow(),
|
||||||
HEventList::HEventList(BRect rect, const char* name)
|
fName(name)
|
||||||
: BListView(rect, name, B_SINGLE_SELECTION_LIST,
|
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE),
|
|
||||||
fType(NULL)
|
|
||||||
{
|
{
|
||||||
|
SetPath(path);
|
||||||
|
SetField(new BStringField(name), kEventColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Destructor
|
HEventRow::~HEventRow()
|
||||||
***********************************************************/
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
HEventRow::SetPath(const char* _path)
|
||||||
|
{
|
||||||
|
fPath = _path;
|
||||||
|
BPath path(_path);
|
||||||
|
SetField(new BStringField(_path ? path.Leaf() : "<none>"), kSoundColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
HEventRow::Remove(const char *type)
|
||||||
|
{
|
||||||
|
BMediaFiles().RemoveItem(type, Name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HEventList::HEventList(BRect rect, const char* name)
|
||||||
|
: BColumnListView(rect, name, B_FOLLOW_ALL, 0, B_NO_BORDER, true),
|
||||||
|
fType(NULL)
|
||||||
|
{
|
||||||
|
AddColumn(new BStringColumn("Event", 150, 50, 500, B_TRUNCATE_MIDDLE), kEventColumn);
|
||||||
|
AddColumn(new BStringColumn("Sound", 150, 50, 500, B_TRUNCATE_END), kSoundColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HEventList::~HEventList()
|
HEventList::~HEventList()
|
||||||
{
|
{
|
||||||
RemoveAll();
|
RemoveAll();
|
||||||
delete fType;
|
delete fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Set type
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
HEventList::SetType(const char* type)
|
HEventList::SetType(const char* type)
|
||||||
{
|
{
|
||||||
@@ -66,76 +76,64 @@ HEventList::SetType(const char* type)
|
|||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
while (mfiles.GetNextRef(&name,&ref) == B_OK) {
|
while (mfiles.GetNextRef(&name,&ref) == B_OK) {
|
||||||
BPath path(&ref);
|
BPath path(&ref);
|
||||||
AddItem(new HEventItem(name.String(), path.Path()));
|
if ((path.InitCheck() == B_OK) || (ref.name == NULL) || (strcmp(ref.name, "") == 0))
|
||||||
|
AddRow(new HEventRow(name.String(), path.Path()));
|
||||||
|
else
|
||||||
|
AddRow(new HEventRow(name.String(), NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Remove all items
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
HEventList::RemoveAll()
|
HEventList::RemoveAll()
|
||||||
{
|
{
|
||||||
BListItem *item;
|
BRow *row;
|
||||||
while ((item = RemoveItem((int32)0))!=NULL)
|
while ((row = RowAt((int32)0, NULL))!=NULL) {
|
||||||
delete item;
|
RemoveRow(row);
|
||||||
MakeEmpty();
|
delete row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Selection Changed
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
HEventList::SelectionChanged()
|
HEventList::SelectionChanged()
|
||||||
{
|
{
|
||||||
BListView::SelectionChanged();
|
BColumnListView::SelectionChanged();
|
||||||
|
|
||||||
int32 sel = CurrentSelection();
|
HEventRow* row = (HEventRow *)CurrentSelection();
|
||||||
if (sel >= 0) {
|
if (row != NULL) {
|
||||||
HEventItem *item = cast_as(ItemAt(sel),HEventItem);
|
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BMediaFiles().GetRefFor(fType, item->Name(), &ref);
|
BMediaFiles().GetRefFor(fType, row->Name(), &ref);
|
||||||
|
|
||||||
BPath path(&ref);
|
BPath path(&ref);
|
||||||
if ((path.InitCheck()==B_OK) || (ref.name == NULL) || (strcmp(ref.name, "")==0)) {
|
if ((path.InitCheck()==B_OK) || (ref.name == NULL) || (strcmp(ref.name, "") == 0)) {
|
||||||
item->SetPath(path.Path());
|
row->SetPath(path.Path());
|
||||||
InvalidateItem(sel);
|
UpdateRow(row);
|
||||||
} else {
|
} else {
|
||||||
printf("name %s\n", ref.name);
|
printf("name %s\n", ref.name);
|
||||||
BMediaFiles().RemoveRefFor(fType, item->Name(), ref);
|
BMediaFiles().RemoveRefFor(fType, row->Name(), ref);
|
||||||
(new BAlert("alert", "No such file or directory", "Ok"))->Go();
|
(new BAlert("alert", "No such file or directory", "Ok"))->Go();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BMessage msg(M_EVENT_CHANGED);
|
BMessage msg(M_EVENT_CHANGED);
|
||||||
msg.AddString("name",item->Name());
|
msg.AddString("name", row->Name());
|
||||||
|
msg.AddString("path", row->Path());
|
||||||
msg.AddString("path",item->Path());
|
|
||||||
Window()->PostMessage(&msg);
|
Window()->PostMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* SetPath
|
|
||||||
***********************************************************/
|
|
||||||
void
|
void
|
||||||
HEventList::SetPath(const char* path)
|
HEventList::SetPath(const char* path)
|
||||||
{
|
{
|
||||||
int32 sel = CurrentSelection();
|
HEventRow* row = (HEventRow *)CurrentSelection();
|
||||||
if (sel >= 0) {
|
if (row != NULL) {
|
||||||
HEventItem *item = cast_as(ItemAt(sel),HEventItem);
|
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BEntry entry(path);
|
BEntry entry(path);
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
BMediaFiles().SetRefFor(fType, item->Name(), ref);
|
BMediaFiles().SetRefFor(fType, row->Name(), ref);
|
||||||
|
|
||||||
item->SetPath(path);
|
row->SetPath(path);
|
||||||
InvalidateItem(sel);
|
UpdateRow(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,57 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
/*
|
||||||
//
|
* Copyright 2003-2008 Haiku Inc. All rights reserved.
|
||||||
// Copyright (c) 2003, OpenBeOS
|
* Distributed under the terms of the MIT license.
|
||||||
//
|
*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Authors:
|
||||||
// by the OpenBeOS license.
|
* Jérôme Duval
|
||||||
//
|
* Oliver Ruiz Dorantes
|
||||||
//
|
* Atsushi Takamatsu
|
||||||
// File: HEventList.h
|
*/
|
||||||
// Author: Jérôme Duval, Oliver Ruiz Dorantes, Atsushi Takamatsu
|
|
||||||
// Description: Sounds Preferences
|
|
||||||
// Created : November 24, 2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
|
|
||||||
#ifndef __HEVENTLIST_H__
|
#ifndef __HEVENTLIST_H__
|
||||||
#define __HEVENTLIST_H__
|
#define __HEVENTLIST_H__
|
||||||
|
|
||||||
#include <ListView.h>
|
#include <ColumnListView.h>
|
||||||
#include "HEventItem.h"
|
#include <String.h>
|
||||||
|
|
||||||
enum{
|
enum {
|
||||||
|
kEventColumn,
|
||||||
|
kSoundColumn,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class HEventRow : public BRow {
|
||||||
|
public:
|
||||||
|
HEventRow(const char* event_name,
|
||||||
|
const char* path);
|
||||||
|
virtual ~HEventRow();
|
||||||
|
|
||||||
|
const char* Name() const { return fName.String();}
|
||||||
|
const char* Path() const { return fPath.String();}
|
||||||
|
void Remove(const char *type);
|
||||||
|
void SetPath(const char* path);
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString fName;
|
||||||
|
BString fPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
M_EVENT_CHANGED = 'SCAG'
|
M_EVENT_CHANGED = 'SCAG'
|
||||||
};
|
};
|
||||||
|
|
||||||
class HEventList : public BListView {
|
|
||||||
|
class HEventList : public BColumnListView {
|
||||||
public:
|
public:
|
||||||
HEventList(BRect rect
|
HEventList(BRect rect,
|
||||||
, const char* name="EventList");
|
const char* name = "EventList");
|
||||||
virtual ~HEventList();
|
virtual ~HEventList();
|
||||||
void RemoveAll();
|
void RemoveAll();
|
||||||
void SetType(const char* type);
|
void SetType(const char* type);
|
||||||
void SetPath(const char* path);
|
void SetPath(const char* path);
|
||||||
protected:
|
protected:
|
||||||
virtual void SelectionChanged();
|
virtual void SelectionChanged();
|
||||||
private:
|
private:
|
||||||
char *fType;
|
char *fType;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ HWindow::HWindow(BRect rect, const char *name)
|
|||||||
|
|
||||||
fFilePanel = new BFilePanel();
|
fFilePanel = new BFilePanel();
|
||||||
fFilePanel->SetTarget(this);
|
fFilePanel->SetTarget(this);
|
||||||
|
|
||||||
fEventList->Select(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,28 +69,13 @@ HWindow::InitGUI()
|
|||||||
listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(listView);
|
AddChild(listView);
|
||||||
|
|
||||||
BRect stringRect(16, 5, 60, 22);
|
|
||||||
BStringView *stringView = new BStringView(stringRect, "event", "Event");
|
|
||||||
stringView->SetFont(be_bold_font);
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
listView->AddChild(stringView);
|
|
||||||
|
|
||||||
stringRect.OffsetBy(120, 0);
|
|
||||||
stringView = new BStringView(stringRect, "sound", "Sound");
|
|
||||||
stringView->SetFont(be_bold_font);
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
listView->AddChild(stringView);
|
|
||||||
|
|
||||||
rect.left += 13;
|
rect.left += 13;
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH + 13;
|
rect.right -= 13;
|
||||||
rect.top += 28;
|
rect.top += 28;
|
||||||
rect.bottom -= 7;
|
rect.bottom -= 7;
|
||||||
fEventList = new HEventList(rect);
|
fEventList = new HEventList(rect);
|
||||||
fEventList->SetType(BMediaFiles::B_SOUNDS);
|
fEventList->SetType(BMediaFiles::B_SOUNDS);
|
||||||
|
listView->AddChild(fEventList);
|
||||||
BScrollView *scrollView = new BScrollView("", fEventList, B_FOLLOW_ALL, 0,
|
|
||||||
false, true);
|
|
||||||
listView->AddChild(scrollView);
|
|
||||||
|
|
||||||
rect = Bounds();
|
rect = Bounds();
|
||||||
rect.top = rect.bottom - 105;
|
rect.top = rect.bottom - 105;
|
||||||
@@ -158,10 +141,9 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
||||||
BMenu *menu = menufield->Menu();
|
BMenu *menu = menufield->Menu();
|
||||||
|
|
||||||
int32 sel = fEventList->CurrentSelection();
|
HEventRow* row = (HEventRow *)fEventList->CurrentSelection();
|
||||||
if (sel >= 0) {
|
if (row != NULL) {
|
||||||
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
|
BPath path(row->Path());
|
||||||
BPath path(item->Path());
|
|
||||||
if (path.InitCheck() != B_OK) {
|
if (path.InitCheck() != B_OK) {
|
||||||
BMenuItem *item = menu->FindItem("<none>");
|
BMenuItem *item = menu->FindItem("<none>");
|
||||||
if (item)
|
if (item)
|
||||||
@@ -180,8 +162,8 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
int32 sel = fEventList->CurrentSelection();
|
HEventRow* row = (HEventRow *)fEventList->CurrentSelection();
|
||||||
if (message->FindRef("refs", &ref) == B_OK && sel >= 0) {
|
if (message->FindRef("refs", &ref) == B_OK && row != NULL) {
|
||||||
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
||||||
BMenu *menu = menufield->Menu();
|
BMenu *menu = menufield->Menu();
|
||||||
|
|
||||||
@@ -218,10 +200,9 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
case M_PLAY_MESSAGE:
|
case M_PLAY_MESSAGE:
|
||||||
{
|
{
|
||||||
int32 sel = fEventList->CurrentSelection();
|
HEventRow* row = (HEventRow *)fEventList->CurrentSelection();
|
||||||
if (sel >= 0) {
|
if (row != NULL) {
|
||||||
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
|
const char *path = row->Path();
|
||||||
const char *path = item->Path();
|
|
||||||
if (path) {
|
if (path) {
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
::get_ref_for_path(path, &ref);
|
::get_ref_for_path(path, &ref);
|
||||||
@@ -291,13 +272,13 @@ HWindow::SetupMenuField()
|
|||||||
{
|
{
|
||||||
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
||||||
BMenu *menu = menufield->Menu();
|
BMenu *menu = menufield->Menu();
|
||||||
int32 count = fEventList->CountItems();
|
int32 count = fEventList->CountRows();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem);
|
HEventRow *row = (HEventRow *)fEventList->RowAt(i);
|
||||||
if (!item)
|
if (!row)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BPath path(item->Path());
|
BPath path(row->Path());
|
||||||
if (path.InitCheck() != B_OK)
|
if (path.InitCheck() != B_OK)
|
||||||
continue;
|
continue;
|
||||||
if (menu->FindItem(path.Leaf()))
|
if (menu->FindItem(path.Leaf()))
|
||||||
@@ -383,7 +364,7 @@ HWindow::SetupMenuField()
|
|||||||
void
|
void
|
||||||
HWindow::Pulse()
|
HWindow::Pulse()
|
||||||
{
|
{
|
||||||
int32 sel = fEventList->CurrentSelection();
|
HEventRow* row = (HEventRow *)fEventList->CurrentSelection();
|
||||||
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
|
||||||
BButton *button = cast_as(FindView("play"), BButton);
|
BButton *button = cast_as(FindView("play"), BButton);
|
||||||
BButton *stop = cast_as(FindView("stop"), BButton);
|
BButton *stop = cast_as(FindView("stop"), BButton);
|
||||||
@@ -391,11 +372,10 @@ HWindow::Pulse()
|
|||||||
if (!menufield)
|
if (!menufield)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sel >= 0) {
|
if (row != NULL) {
|
||||||
menufield->SetEnabled(true);
|
menufield->SetEnabled(true);
|
||||||
|
|
||||||
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
|
const char *path = row->Path();
|
||||||
const char *path = item->Path();
|
|
||||||
if (path && strcmp(path, ""))
|
if (path && strcmp(path, ""))
|
||||||
button->SetEnabled(true);
|
button->SetEnabled(true);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,15 +2,13 @@ SubDir HAIKU_TOP src preferences sounds ;
|
|||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
|
||||||
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
UsePrivateHeaders interface ;
|
||||||
SubDirC++Flags -fmultiple-symbol-spaces ;
|
|
||||||
}
|
|
||||||
|
|
||||||
Preference Sounds :
|
Preference Sounds :
|
||||||
HApp.cpp
|
HApp.cpp
|
||||||
HEventItem.cpp
|
# HEventItem.cpp
|
||||||
HWindow.cpp
|
HWindow.cpp
|
||||||
HEventList.cpp
|
HEventList.cpp
|
||||||
: be game tracker libmedia.so
|
: be libcolumnlistview.a game tracker libmedia.so
|
||||||
: Sounds.rdef
|
: Sounds.rdef
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user