style cleanup

whitespace => tab


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23505 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2008-01-13 23:05:30 +00:00
parent 69666c9199
commit 269fdeefff
35 changed files with 382 additions and 385 deletions

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Appearance", short_info = "Appearance",
long_info = "Appearance ©2002-2007 Haiku" long_info = "Appearance ©2002-2007 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -313,8 +313,8 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
followFlags, tile); followFlags, tile);
view->Invalidate(); view->Invalidate();
/*if(fShowingBitmap != info) { /*if (fShowingBitmap != info) {
if(fShowingBitmap) if (fShowingBitmap)
fShowingBitmap->UnloadBitmap(fCacheMode); fShowingBitmap->UnloadBitmap(fCacheMode);
fShowingBitmap = info; fShowingBitmap = info;
}*/ }*/
@ -484,8 +484,8 @@ BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage,
void void
BackgroundImage::ChangeImageSet(BPoseView *poseView) BackgroundImage::ChangeImageSet(BPoseView *poseView)
{ {
if(fRandomChange) { if (fRandomChange) {
if(fImageSetCount > 1) { if (fImageSetCount > 1) {
uint32 oldShowingImageSet = fShowingImageSet; uint32 oldShowingImageSet = fShowingImageSet;
while(oldShowingImageSet == fShowingImageSet) while(oldShowingImageSet == fShowingImageSet)
fShowingImageSet = random()%fImageSetCount; fShowingImageSet = random()%fImageSetCount;
@ -493,7 +493,7 @@ BackgroundImage::ChangeImageSet(BPoseView *poseView)
fShowingImageSet = 0; fShowingImageSet = 0;
} else { } else {
fShowingImageSet++; fShowingImageSet++;
if(fShowingImageSet > fImageSetCount - 1) if (fShowingImageSet > fImageSetCount - 1)
fShowingImageSet = 0; fShowingImageSet = 0;
} }

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Backgrounds", short_info = "Backgrounds",
long_info = "Backgrounds ©2002-2006 Haiku" long_info = "Backgrounds ©2002-2006 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -66,12 +66,12 @@ RangeConfItem::~RangeConfItem()
/*********************************************************** /***********************************************************
* DrawItem * DrawItem
***********************************************************/ ***********************************************************/
void void
RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete) RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete)
{ {
rgb_color kBlack = { 0,0,0,0 }; rgb_color kBlack = { 0,0,0,0 };
rgb_color kHighlight = { 156,154,156,0 }; rgb_color kHighlight = { 156,154,156,0 };
if (IsSelected() || complete) { if (IsSelected() || complete) {
rgb_color color; rgb_color color;
if (IsSelected()) if (IsSelected())
@ -83,7 +83,6 @@ RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->SetLowColor(color); owner->SetLowColor(color);
owner->FillRect(itemRect); owner->FillRect(itemRect);
owner->SetHighColor(kBlack); owner->SetHighColor(kBlack);
} else { } else {
owner->SetLowColor(owner->ViewColor()); owner->SetLowColor(owner->ViewColor());
} }
@ -98,8 +97,8 @@ RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->MovePenTo(point); owner->MovePenTo(point);
char string[20]; char string[20];
if (fLowAddress >= 0) { if (fLowAddress >= 0) {
sprintf(string, "0x%04lx", fLowAddress); sprintf(string, "0x%04lx", fLowAddress);
owner->DrawString(string); owner->DrawString(string);
} }
@ -111,8 +110,8 @@ RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete)
point += BPoint(15, 0); point += BPoint(15, 0);
owner->MovePenTo(point); owner->MovePenTo(point);
owner->SetFont(be_plain_font); owner->SetFont(be_plain_font);
if (fHighAddress >= 0) { if (fHighAddress >= 0) {
sprintf(string, "0x%04lx", fHighAddress); sprintf(string, "0x%04lx", fHighAddress);
owner->DrawString(string); owner->DrawString(string);
} }
@ -141,10 +140,10 @@ RangeConfItem::Compare(const void *firstArg, const void *secondArg)
ConfigurationWindow::ConfigurationWindow(BRect frame, DeviceItem *item) ConfigurationWindow::ConfigurationWindow(BRect frame, DeviceItem *item)
: BWindow (frame, item->GetInfo()->GetCardName(), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL , : BWindow (frame, item->GetInfo()->GetCardName(), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL ,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE|B_NOT_RESIZABLE), B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE|B_NOT_RESIZABLE),
fItem(item) fItem(item)
{ {
CenterWindowOnScreen(this); CenterWindowOnScreen(this);
fItem->SetWindow(this); fItem->SetWindow(this);
InitWindow(); InitWindow();
Show(); Show();
@ -173,12 +172,12 @@ ConfigurationWindow::InitWindow(void)
BRect rtab = Bounds(); BRect rtab = Bounds();
BRect rlist = Bounds(); BRect rlist = Bounds();
rtab.top += 10; rtab.top += 10;
rlist.top += 11; rlist.top += 11;
rlist.left += 13; rlist.left += 13;
rlist.right -= 13; rlist.right -= 13;
rlist.bottom -= 44; rlist.bottom -= 44;
// Create the TabView and Tabs // Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview"); BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@ -188,8 +187,8 @@ ConfigurationWindow::InitWindow(void)
// Create the Views // Create the Views
BBox *resources = new BBox(rlist, "resources", BBox *resources = new BBox(rlist, "resources",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
BMenuItem *menuItem; BMenuItem *menuItem;
fConfigurationMenu = new BPopUpMenu("<empty>"); fConfigurationMenu = new BPopUpMenu("<empty>");
fConfigurationMenu->AddItem(menuItem = new BMenuItem("Current Configuration", fConfigurationMenu->AddItem(menuItem = new BMenuItem("Current Configuration",
@ -263,12 +262,12 @@ ConfigurationWindow::InitWindow(void)
fDMAMenu[0]->Superitem()->SetLabel(""); fDMAMenu[0]->Superitem()->SetLabel("");
fDMAMenu[1]->Superitem()->SetLabel(""); fDMAMenu[1]->Superitem()->SetLabel("");
fDMAMenu[2]->Superitem()->SetLabel(""); fDMAMenu[2]->Superitem()->SetLabel("");
BRect boxRect = resources->Bounds(); BRect boxRect = resources->Bounds();
boxRect.top = 74; boxRect.top = 74;
boxRect.left += 13; boxRect.left += 13;
boxRect.right -= 11; boxRect.right -= 11;
boxRect.bottom = boxRect.top + 141; boxRect.bottom = boxRect.top + 141;
BBox *ioPortBox = new BBox(boxRect, "ioPort", BBox *ioPortBox = new BBox(boxRect, "ioPort",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
ioPortBox->SetLabel(new BStringView(BRect(0,0,150,15), "ioPortLabel", " IO Port Ranges ")); ioPortBox->SetLabel(new BStringView(BRect(0,0,150,15), "ioPortLabel", " IO Port Ranges "));
@ -348,7 +347,7 @@ ConfigurationWindow::InitWindow(void)
for (int32 i=0;i<num;i++) { for (int32 i=0;i<num;i++) {
get_nth_resource_descriptor_of_type(current, i, B_IO_PORT_RESOURCE, get_nth_resource_descriptor_of_type(current, i, B_IO_PORT_RESOURCE,
&r, sizeof(resource_descriptor)); &r, sizeof(resource_descriptor));
ioListView->AddItem(new RangeConfItem(r.d.r.minbase, ioListView->AddItem(new RangeConfItem(r.d.r.minbase,
r.d.r.minbase + r.d.r.len - 1)); r.d.r.minbase + r.d.r.len - 1));
} }
@ -363,7 +362,7 @@ ConfigurationWindow::InitWindow(void)
for (int32 i=0;i<num;i++) { for (int32 i=0;i<num;i++) {
get_nth_resource_descriptor_of_type(current, i, B_MEMORY_RESOURCE, get_nth_resource_descriptor_of_type(current, i, B_MEMORY_RESOURCE,
&r, sizeof(resource_descriptor)); &r, sizeof(resource_descriptor));
memoryListView->AddItem(new RangeConfItem(r.d.r.minbase, memoryListView->AddItem(new RangeConfItem(r.d.r.minbase,
r.d.r.minbase + r.d.r.len - 1)); r.d.r.minbase + r.d.r.len - 1));
} }
@ -374,7 +373,7 @@ ConfigurationWindow::InitWindow(void)
BBox *info = new BBox(rlist, "info", BBox *info = new BBox(rlist, "info",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER); B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER);
bool isISAPnP = false; bool isISAPnP = false;
BString compatibleIDString; BString compatibleIDString;
@ -384,14 +383,14 @@ ConfigurationWindow::InitWindow(void)
&& (((id >> 16) & 0xff) == 'n') && (((id >> 16) & 0xff) == 'n')
&& (((id >> 8) & 0xff) == 'P')) { && (((id >> 8) & 0xff) == 'P')) {
isISAPnP = true; isISAPnP = true;
char string[255]; char string[255];
sprintf(string, "Compatible ID #%ld:", sprintf(string, "Compatible ID #%ld:",
devicesInfo->GetInfo()->id[3]); devicesInfo->GetInfo()->id[3]);
compatibleIDString = string; compatibleIDString = string;
} }
} }
BRect labelRect(1, 10, 132, 30); BRect labelRect(1, 10, 132, 30);
BStringView *label = new BStringView(labelRect, "Card Name", "Card Name:"); BStringView *label = new BStringView(labelRect, "Card Name", "Card Name:");
label->SetAlignment(B_ALIGN_RIGHT); label->SetAlignment(B_ALIGN_RIGHT);
@ -429,7 +428,7 @@ ConfigurationWindow::InitWindow(void)
label = new BStringView(labelRect, "Compatible ID#", compatibleIDString.String()); label = new BStringView(labelRect, "Compatible ID#", compatibleIDString.String());
label->SetAlignment(B_ALIGN_RIGHT); label->SetAlignment(B_ALIGN_RIGHT);
info->AddChild(label); info->AddChild(label);
} }
labelRect.OffsetBy(0, 18); labelRect.OffsetBy(0, 18);
label = new BStringView(labelRect, "Current State", "Current State:"); label = new BStringView(labelRect, "Current State", "Current State:");
label->SetAlignment(B_ALIGN_RIGHT); label->SetAlignment(B_ALIGN_RIGHT);
@ -469,7 +468,7 @@ ConfigurationWindow::InitWindow(void)
BString logicalString; BString logicalString;
switch (devicesInfo->GetInfo()->bus) { switch (devicesInfo->GetInfo()->bus) {
case B_ISA_BUS: case B_ISA_BUS:
{ {
char string[255]; char string[255];
if (isISAPnP) { if (isISAPnP) {
@ -483,7 +482,7 @@ ConfigurationWindow::InitWindow(void)
(uint8)(id >> 28) & 0xf, (uint8)(id >> 28) & 0xf,
(uint8)((id >> 24) & 0xf)); (uint8)((id >> 24) & 0xf));
vendor = string; vendor = string;
sprintf(string, "%08lx", devicesInfo->GetInfo()->id[2]); sprintf(string, "%08lx", devicesInfo->GetInfo()->id[2]);
cardID = string; cardID = string;
@ -509,7 +508,7 @@ ConfigurationWindow::InitWindow(void)
(uint8)(id >> 16) & 0xf, (uint8)(id >> 16) & 0xf,
(uint8)(id >> 20) & 0xf, (uint8)(id >> 20) & 0xf,
(uint8)((id >> 24) & 0xff)); (uint8)((id >> 24) & 0xff));
vendor = string; vendor = string;
cardID = "0"; cardID = "0";
} }
@ -537,7 +536,7 @@ ConfigurationWindow::InitWindow(void)
break; break;
} }
} }
} }
break; break;
case B_PCMCIA_BUS: vendor = "XX"; break; case B_PCMCIA_BUS: vendor = "XX"; break;
default: vendor = "<Unknown>"; break; default: vendor = "<Unknown>"; break;
@ -590,7 +589,7 @@ ConfigurationWindow::InitWindow(void)
label = new BStringView(labelRect, "Resource Conflicts", resourceConflicts.String()); label = new BStringView(labelRect, "Resource Conflicts", resourceConflicts.String());
info->AddChild(label); info->AddChild(label);
BTab *tab = new BTab(); BTab *tab = new BTab();
tabView->AddTab(resources, tab); tabView->AddTab(resources, tab);
tab->SetLabel("Resources"); tab->SetLabel("Resources");
@ -624,7 +623,7 @@ bool
ConfigurationWindow::QuitRequested() ConfigurationWindow::QuitRequested()
{ {
fItem->SetWindow(NULL); fItem->SetWindow(NULL);
return true; return true;
} }
// ---------------------------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------------------------- //

View File

@ -24,8 +24,8 @@
class Devices : public BApplication class Devices : public BApplication
{ {
public: public:
Devices(); Devices();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
private: private:
@ -47,20 +47,21 @@ void Devices::MessageReceived (BMessage *message)
{ {
switch(message->what) switch(message->what)
{ {
default: default:
BApplication::MessageReceived(message); // pass it along ... BApplication::MessageReceived(message); // pass it along ...
break; break;
} }
} }
// ---------------------------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------------------------- //
// Devices Main // Devices Main
int main(void) int
main(void)
{ {
Devices theApp; Devices theApp;
theApp.Run(); theApp.Run();
return 0; return 0;
} }
// end ------------------------------------------------------------------------------------------------------ // // end ------------------------------------------------------------------------------------------------------ //

View File

@ -14,7 +14,7 @@ resource app_version
internal = 0, internal = 0,
short_info = "Devices", short_info = "Devices",
long_info = "Devices ©2002-2007 Haiku" long_info = "Devices ©2002-2007 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -202,7 +202,7 @@ DeviceItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->MovePenTo(point); owner->MovePenTo(point);
owner->DrawString(fName); owner->DrawString(fName);
if(fInfo) { if (fInfo) {
point += BPoint(222, 0); point += BPoint(222, 0);
BString string = "enabled"; BString string = "enabled";
if (!(fInfo->GetInfo()->flags & B_DEVICE_INFO_ENABLED)) if (!(fInfo->GetInfo()->flags & B_DEVICE_INFO_ENABLED))

View File

@ -23,10 +23,10 @@
class DevicesInfo class DevicesInfo
{ {
public: public:
DevicesInfo(struct device_info *info, DevicesInfo(struct device_info *info,
struct device_configuration *current, struct device_configuration *current,
struct possible_device_configurations *possible); struct possible_device_configurations *possible);
~DevicesInfo(); ~DevicesInfo();
struct device_info * GetInfo() { return fInfo;} struct device_info * GetInfo() { return fInfo;}
char * GetDeviceName() const { return fDeviceName; } char * GetDeviceName() const { return fDeviceName; }
char * GetCardName() const { return fCardName; } char * GetCardName() const { return fCardName; }

View File

@ -69,25 +69,25 @@ DevicesWindow::DevicesWindow(BRect frame) : BWindow (frame, "Devices", B_TITLED_
CenterWindowOnScreen(this); CenterWindowOnScreen(this);
// Load User Settings // Load User Settings
BPath path; BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY,&path); find_directory(B_USER_SETTINGS_DIRECTORY,&path);
path.Append("Devices_Settings",true); path.Append("Devices_Settings",true);
BFile file(path.Path(),B_READ_ONLY); BFile file(path.Path(),B_READ_ONLY);
BMessage msg; BMessage msg;
msg.Unflatten(&file); msg.Unflatten(&file);
LoadSettings (&msg); LoadSettings (&msg);
status_t error; status_t error;
if ((error = init_cm_wrapper()) < 0) { if ((error = init_cm_wrapper()) < 0) {
printf("Error initializing configuration manager (%s)\n", strerror(error)); printf("Error initializing configuration manager (%s)\n", strerror(error));
exit(1); exit(1);
} }
InitDevices(B_ISA_BUS); InitDevices(B_ISA_BUS);
InitDevices(B_PCI_BUS); InitDevices(B_PCI_BUS);
for (int32 i=fList.CountItems()-1; i>=0; i--) { for (int32 i=fList.CountItems()-1; i>=0; i--) {
DevicesInfo *deviceInfo = (DevicesInfo *) fList.ItemAt(i); DevicesInfo *deviceInfo = (DevicesInfo *) fList.ItemAt(i);
struct device_info *info = deviceInfo->GetInfo(); struct device_info *info = deviceInfo->GetInfo();
BListItem *item = systemMenu; BListItem *item = systemMenu;
@ -253,7 +253,7 @@ bool DevicesWindow::QuitRequested()
{ {
SaveSettings(); SaveSettings();
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
// ---------------------------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------------------------- //
@ -277,12 +277,12 @@ void DevicesWindow::SaveSettings(void)
BMessage msg; BMessage msg;
msg.AddRect("windowframe",Frame()); msg.AddRect("windowframe",Frame());
BPath path; BPath path;
status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path); status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path);
if (result == B_OK) if (result == B_OK)
{ {
path.Append("Devices_Settings",true); path.Append("Devices_Settings",true);
BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
msg.Flatten(&file); msg.Flatten(&file);
} }
} }

View File

@ -35,10 +35,10 @@ void CenterWindowOnScreen(BWindow* w);
class ResourceUsageWindow : public BWindow { class ResourceUsageWindow : public BWindow {
public: public:
ResourceUsageWindow(BRect frame, BList &); ResourceUsageWindow(BRect frame, BList &);
~ResourceUsageWindow(); ~ResourceUsageWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
private: private:
void InitWindow(BList &); void InitWindow(BList &);
}; };
@ -46,19 +46,19 @@ class ResourceUsageWindow : public BWindow {
class ModemWindow : public BWindow { class ModemWindow : public BWindow {
public: public:
ModemWindow(BRect frame, BMessenger); ModemWindow(BRect frame, BMessenger);
~ModemWindow(); ~ModemWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
private: private:
void InitWindow(void); void InitWindow(void);
BMessenger fMessenger; BMessenger fMessenger;
}; };
class ConfigurationWindow : public BWindow { class ConfigurationWindow : public BWindow {
public: public:
ConfigurationWindow(BRect frame, DeviceItem *item); ConfigurationWindow(BRect frame, DeviceItem *item);
~ConfigurationWindow(); ~ConfigurationWindow();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
private: private:
void InitWindow(void); void InitWindow(void);
@ -74,9 +74,9 @@ class ConfigurationWindow : public BWindow {
class DevicesWindow : public BWindow { class DevicesWindow : public BWindow {
public: public:
DevicesWindow(BRect frame); DevicesWindow(BRect frame);
~DevicesWindow(); ~DevicesWindow();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
private: private:
void InitWindow(void); void InitWindow(void);
@ -89,19 +89,19 @@ class DevicesWindow : public BWindow {
ResourceUsageWindow* ptrResourceUsageWindow; ResourceUsageWindow* ptrResourceUsageWindow;
ModemWindow* ptrModemWindow; ModemWindow* ptrModemWindow;
BStringView *stvDeviceName; BStringView *stvDeviceName;
BStringView *stvCurrentState; BStringView *stvCurrentState;
BMenuBar *menubar; BMenuBar *menubar;
BList fList; BList fList;
BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu; BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu;
BOutlineListView *outline; BOutlineListView *outline;
BStringView *stvIRQ; BStringView *stvIRQ;
BStringView *stvDMA; BStringView *stvDMA;
BStringView *stvIORanges; BStringView *stvIORanges;
BStringView *stvMemoryRanges; BStringView *stvMemoryRanges;
BButton *btnConfigure; BButton *btnConfigure;
}; };
#endif #endif

View File

@ -52,12 +52,12 @@ IRQDMAItem::~IRQDMAItem()
/*********************************************************** /***********************************************************
* DrawItem * DrawItem
***********************************************************/ ***********************************************************/
void void
IRQDMAItem::DrawItem(BView *owner, BRect itemRect, bool complete) IRQDMAItem::DrawItem(BView *owner, BRect itemRect, bool complete)
{ {
rgb_color kBlack = { 0,0,0,0 }; rgb_color kBlack = { 0,0,0,0 };
rgb_color kHighlight = { 156,154,156,0 }; rgb_color kHighlight = { 156,154,156,0 };
if (IsSelected() || complete) { if (IsSelected() || complete) {
rgb_color color; rgb_color color;
if (IsSelected()) if (IsSelected())
@ -122,12 +122,12 @@ RangeItem::~RangeItem()
/*********************************************************** /***********************************************************
* DrawItem * DrawItem
***********************************************************/ ***********************************************************/
void void
RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete)
{ {
rgb_color kBlack = { 0,0,0,0 }; rgb_color kBlack = { 0,0,0,0 };
rgb_color kHighlight = { 156,154,156,0 }; rgb_color kHighlight = { 156,154,156,0 };
if (IsSelected() || complete) { if (IsSelected() || complete) {
rgb_color color; rgb_color color;
if (IsSelected()) if (IsSelected())
@ -208,12 +208,12 @@ void ResourceUsageWindow::InitWindow(BList &list)
BRect rtab = Bounds(); BRect rtab = Bounds();
BRect rlist = Bounds(); BRect rlist = Bounds();
rtab.top += 10; rtab.top += 10;
rlist.top += 10; rlist.top += 10;
rlist.left += 12; rlist.left += 12;
rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH; rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH;
rlist.bottom -= 47; rlist.bottom -= 47;
// Create the TabView and Tabs // Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview"); BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@ -229,7 +229,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BListView *memoryListView = new BListView(rlist, "memoryListView", B_SINGLE_SELECTION_LIST, BListView *memoryListView = new BListView(rlist, "memoryListView", B_SINGLE_SELECTION_LIST,
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BScrollView *IRQScrollView = new BScrollView("scroll_list1", IRQListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, BScrollView *IRQScrollView = new BScrollView("scroll_list1", IRQListView, B_FOLLOW_LEFT|B_FOLLOW_TOP,
0, false, true, B_FANCY_BORDER); 0, false, true, B_FANCY_BORDER);
BScrollView *DMAScrollView = new BScrollView("scroll_list2", DMAListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, BScrollView *DMAScrollView = new BScrollView("scroll_list2", DMAListView, B_FOLLOW_LEFT|B_FOLLOW_TOP,
@ -251,18 +251,18 @@ void ResourceUsageWindow::InitWindow(BList &list)
tab = new BTab(); tab = new BTab();
tabView->AddTab(memoryScrollView, tab); tabView->AddTab(memoryScrollView, tab);
tab->SetLabel("Memory Range"); tab->SetLabel("Memory Range");
{ {
uint32 mask = 1; uint32 mask = 1;
for (int i=0;i<16;mask<<=1,i++) { for (int i=0;i<16;mask<<=1,i++) {
bool first = true; bool first = true;
for (int32 j=0; j<list.CountItems(); j++) { for (int32 j=0; j<list.CountItems(); j++) {
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j); DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent(); struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r; resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current, B_IRQ_RESOURCE); int32 num = count_resource_descriptors_of_type(current, B_IRQ_RESOURCE);
for (int32 k=0;k<num;k++) { for (int32 k=0;k<num;k++) {
@ -270,7 +270,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
&r, sizeof(resource_descriptor)); &r, sizeof(resource_descriptor));
if (mask & r.d.m.mask) { if (mask & r.d.m.mask) {
IRQListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); IRQListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName()));
first = false; first = false;
} }
} }
@ -287,12 +287,12 @@ void ResourceUsageWindow::InitWindow(BList &list)
for (int i=0;i<8;mask<<=1,i++) { for (int i=0;i<8;mask<<=1,i++) {
bool first = true; bool first = true;
for (int32 j=0; j<list.CountItems(); j++) { for (int32 j=0; j<list.CountItems(); j++) {
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j); DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent(); struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r; resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current, B_DMA_RESOURCE); int32 num = count_resource_descriptors_of_type(current, B_DMA_RESOURCE);
for (int32 k=0;k<num;k++) { for (int32 k=0;k<num;k++) {
@ -300,7 +300,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
&r, sizeof(resource_descriptor)); &r, sizeof(resource_descriptor));
if (mask & r.d.m.mask) { if (mask & r.d.m.mask) {
DMAListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); DMAListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName()));
first = false; first = false;
} }
} }
@ -317,7 +317,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j); DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent(); struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r; resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current, B_IO_PORT_RESOURCE); int32 num = count_resource_descriptors_of_type(current, B_IO_PORT_RESOURCE);
for (int32 k=0;k<num;k++) { for (int32 k=0;k<num;k++) {
@ -337,7 +337,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j); DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent(); struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r; resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current, B_MEMORY_RESOURCE); int32 num = count_resource_descriptors_of_type(current, B_MEMORY_RESOURCE);
for (int32 k=0;k<num;k++) { for (int32 k=0;k<num;k++) {

View File

@ -104,7 +104,7 @@ status_t get_possible_configurations_for(uint64 id,
status_t count_resource_descriptors_of_type( status_t count_resource_descriptors_of_type(
struct device_configuration *c, resource_type type) struct device_configuration *c, resource_type type)
{ {
struct cm_ioctl_data params; struct cm_ioctl_data params;

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "DriveSetup", short_info = "DriveSetup",
long_info = "DriveSetup ©2002-2007 Haiku" long_info = "DriveSetup ©2002-2007 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -179,8 +179,8 @@ bool
MainWindow::QuitRequested() MainWindow::QuitRequested()
{ {
// TODO: ask about any unsaved changes // TODO: ask about any unsaved changes
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
Hide(); Hide();
return false; return false;
} }

View File

@ -15,7 +15,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Keyboard", short_info = "Keyboard",
long_info = "Keyboard ©2004-2007 Haiku" long_info = "Keyboard ©2004-2007 Haiku"
}; };
#ifdef HAIKU_TARGET_PLATFORM_HAIKU #ifdef HAIKU_TARGET_PLATFORM_HAIKU

View File

@ -36,12 +36,12 @@ KeyboardSettings::KeyboardSettings()
fCorner.y = 100; fCorner.y = 100;
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
if(status == B_OK) { if (status == B_OK) {
status = path.Append(kb_settings_file); status = path.Append(kb_settings_file);
if(status == B_OK) { if (status == B_OK) {
status = file.SetTo(path.Path(), B_READ_ONLY); status = file.SetTo(path.Path(), B_READ_ONLY);
if (status == B_OK) { if (status == B_OK) {
if(file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) { if (file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) {
fCorner.x = 150; fCorner.x = 150;
fCorner.y = 100; fCorner.y = 100;
} }

View File

@ -23,7 +23,7 @@
KeyboardWindow::KeyboardWindow() KeyboardWindow::KeyboardWindow()
: BWindow(BRect(0, 0, 200, 200), "Keyboard", B_TITLED_WINDOW, : BWindow(BRect(0, 0, 200, 200), "Keyboard", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{ {
MoveTo(fSettings.WindowCorner()); MoveTo(fSettings.WindowCorner());
// center window if it would be off-screen // center window if it would be off-screen
@ -50,7 +50,7 @@ KeyboardWindow::KeyboardWindow()
button->SetEnabled(fSettings.IsDefaultable()); button->SetEnabled(fSettings.IsDefaultable());
#ifdef DEBUG #ifdef DEBUG
fSettings.Dump(); fSettings.Dump();
#endif #endif
Show(); Show();
@ -63,7 +63,7 @@ KeyboardWindow::QuitRequested()
fSettings.SetWindowCorner(Frame().LeftTop()); fSettings.SetWindowCorner(Frame().LeftTop());
#ifdef DEBUG #ifdef DEBUG
fSettings.Dump(); fSettings.Dump();
#endif #endif
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
@ -105,11 +105,11 @@ KeyboardWindow::MessageReceived(BMessage* message)
slider = (BSlider *)FindView("key_repeat_rate"); slider = (BSlider *)FindView("key_repeat_rate");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatRate()); slider->SetValue(fSettings.KeyboardRepeatRate());
slider = (BSlider *)FindView("delay_until_key_repeat"); slider = (BSlider *)FindView("delay_until_key_repeat");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatDelay()); slider->SetValue(fSettings.KeyboardRepeatDelay());
button = (BButton *)FindView("keyboard_defaults"); button = (BButton *)FindView("keyboard_defaults");
if (button !=NULL) if (button !=NULL)
@ -119,7 +119,7 @@ KeyboardWindow::MessageReceived(BMessage* message)
if (button !=NULL) if (button !=NULL)
button->SetEnabled(false); button->SetEnabled(false);
break; break;
} }
case SLIDER_REPEAT_RATE: case SLIDER_REPEAT_RATE:
{ {
int32 rate; int32 rate;
@ -133,7 +133,7 @@ KeyboardWindow::MessageReceived(BMessage* message)
button = (BButton *)FindView("keyboard_revert"); button = (BButton *)FindView("keyboard_revert");
if (button !=NULL) if (button !=NULL)
button->SetEnabled(true); button->SetEnabled(true);
break; break;
} }
case SLIDER_DELAY_RATE: case SLIDER_DELAY_RATE:
@ -165,10 +165,10 @@ KeyboardWindow::MessageReceived(BMessage* message)
button->SetEnabled(fSettings.IsDefaultable()); button->SetEnabled(fSettings.IsDefaultable());
button = (BButton *)FindView("keyboard_revert"); button = (BButton *)FindView("keyboard_revert");
if (button !=NULL) if (button !=NULL)
button->SetEnabled(true); button->SetEnabled(true);
break; break;
} }
default: default:
BWindow::MessageReceived(message); BWindow::MessageReceived(message);

View File

@ -21,34 +21,34 @@
#include <input_globals.h> #include <input_globals.h>
static void static void
print_key( char *chars, int32 offset ) print_key(char *chars, int32 offset)
{ {
int size = chars[offset++]; int size = chars[offset++];
switch( size ) { switch(size) {
case 0: case 0:
// Not mapped // Not mapped
printf( "N/A" ); printf("N/A");
break; break;
case 1: case 1:
// 1-byte UTF-8/ASCII character // 1-byte UTF-8/ASCII character
printf( "%c", chars[offset] ); printf("%c", chars[offset]);
break; break;
default: default:
// 2-, 3-, or 4-byte UTF-8 character // 2-, 3-, or 4-byte UTF-8 character
{ {
char *str = new char[size + 1]; char *str = new char[size + 1];
strncpy( str, &(chars[offset]), size ); strncpy(str, &(chars[offset]), size);
str[size] = 0; str[size] = 0;
printf( "%s", str ); printf("%s", str);
delete [] str; delete [] str;
} }
break; break;
} }
printf( "\t" ); printf("\t");
} }
@ -57,19 +57,19 @@ Keymap::DumpKeymap()
{ {
// Print a chart of the normal, shift, option, and option+shift // Print a chart of the normal, shift, option, and option+shift
// keys. // keys.
printf( "Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n" ); printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n");
for( int idx = 0; idx < 128; idx++ ) { for (int idx = 0; idx < 128; idx++) {
printf( " 0x%x\t", idx ); printf(" 0x%x\t", idx );
print_key( fChars, fKeys.normal_map[idx] ); print_key(fChars, fKeys.normal_map[idx]);
print_key( fChars, fKeys.shift_map[idx] ); print_key(fChars, fKeys.shift_map[idx]);
print_key( fChars, fKeys.caps_map[idx] ); print_key(fChars, fKeys.caps_map[idx]);
print_key( fChars, fKeys.caps_shift_map[idx] ); print_key(fChars, fKeys.caps_shift_map[idx]);
print_key( fChars, fKeys.option_map[idx] ); print_key(fChars, fKeys.option_map[idx]);
print_key( fChars, fKeys.option_shift_map[idx] ); print_key(fChars, fKeys.option_shift_map[idx]);
print_key( fChars, fKeys.option_caps_map[idx] ); print_key(fChars, fKeys.option_caps_map[idx]);
print_key( fChars, fKeys.option_caps_shift_map[idx] ); print_key(fChars, fKeys.option_caps_shift_map[idx]);
print_key( fChars, fKeys.control_map[idx] ); print_key(fChars, fKeys.control_map[idx]);
printf( "\n" ); printf("\n");
} }
} }
@ -371,7 +371,7 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** c
if (strncmp(&(fChars[offset+1]), &(fChars[dead_key[i]+1]), *numBytes ) == 0) { if (strncmp(&(fChars[offset+1]), &(fChars[dead_key[i]+1]), *numBytes ) == 0) {
*numBytes = fChars[dead_key[i+1]]; *numBytes = fChars[dead_key[i+1]];
switch( *numBytes ) { switch(*numBytes) {
case 0: case 0:
// Not mapped // Not mapped
*chars = NULL; *chars = NULL;

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Keymap", short_info = "Keymap",
long_info = "Keymap ©2004-2006 Haiku" long_info = "Keymap ©2004-2006 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -92,7 +92,7 @@ KeymapWindow::KeymapWindow()
entry_ref ref; entry_ref ref;
get_ref_for_path(path.Path(), &ref); get_ref_for_path(path.Path(), &ref);
fOpenPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), &ref, fOpenPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), &ref,
B_FILE_NODE, false, NULL); B_FILE_NODE, false, NULL);
fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), &ref, fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), &ref,
@ -156,7 +156,7 @@ KeymapWindow::AddMenuBar()
menubar->AddItem( menu ); menubar->AddItem( menu );
// Create the Font menu // Create the Font menu
fFontMenu = new BMenu( "Font" ); fFontMenu = new BMenu("Font");
fFontMenu->SetRadioMode(true); fFontMenu->SetRadioMode(true);
int32 numFamilies = count_font_families(); int32 numFamilies = count_font_families();
font_family family, current_family; font_family family, current_family;
@ -164,16 +164,16 @@ KeymapWindow::AddMenuBar()
uint32 flags; uint32 flags;
be_plain_font->GetFamilyAndStyle(&current_family, &current_style); be_plain_font->GetFamilyAndStyle(&current_family, &current_style);
for (int32 i = 0; i < numFamilies; i++ ) for (int32 i = 0; i < numFamilies; i++ )
if ( get_font_family(i, &family, &flags) == B_OK ) { if (get_font_family(i, &family, &flags) == B_OK) {
BMenuItem *item = BMenuItem *item =
new BMenuItem(family, new BMessage( MENU_FONT_CHANGED)); new BMenuItem(family, new BMessage( MENU_FONT_CHANGED));
fFontMenu->AddItem(item); fFontMenu->AddItem(item);
if(strcmp(family, current_family) == 0) if (strcmp(family, current_family) == 0)
item->SetMarked(true); item->SetMarked(true);
} }
menubar->AddItem( fFontMenu ); menubar->AddItem(fFontMenu);
return menubar; return menubar;
} }
@ -207,13 +207,13 @@ KeymapWindow::AddMaps(BView *placeholderView)
fUserListView = new BListView( bounds, "userList" ); fUserListView = new BListView( bounds, "userList" );
// '(Current)' // '(Current)'
KeymapListItem *currentKeymapItem = (KeymapListItem*)fUserListView->FirstItem(); KeymapListItem *currentKeymapItem = (KeymapListItem*)fUserListView->FirstItem();
if( currentKeymapItem != NULL ) if (currentKeymapItem != NULL)
fUserListView->AddItem( currentKeymapItem ); fUserListView->AddItem( currentKeymapItem );
// Saved keymaps // Saved keymaps
mapsBox->AddChild( new BScrollView( "userScrollList", fUserListView, mapsBox->AddChild( new BScrollView( "userScrollList", fUserListView,
B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true )); B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true ));
fUserListView->SetSelectionMessage( new BMessage( USER_MAP_SELECTED )); fUserListView->SetSelectionMessage( new BMessage( USER_MAP_SELECTED ));
FillSystemMaps(); FillSystemMaps();
FillUserMaps(); FillUserMaps();
@ -245,7 +245,7 @@ KeymapWindow::MessageReceived( BMessage* message )
fMapView->Invalidate(); fMapView->Invalidate();
fSystemListView->DeselectAll(); fSystemListView->DeselectAll();
fUserListView->DeselectAll(); fUserListView->DeselectAll();
} }
break; break;
case B_SAVE_REQUESTED: case B_SAVE_REQUESTED:
{ {
@ -261,7 +261,7 @@ KeymapWindow::MessageReceived( BMessage* message )
FillUserMaps(); FillUserMaps();
} }
} }
break; break;
case MENU_FILE_OPEN: case MENU_FILE_OPEN:
fOpenPanel->Show(); fOpenPanel->Show();
@ -285,7 +285,7 @@ KeymapWindow::MessageReceived( BMessage* message )
if (item) { if (item) {
fMapView->SetFontFamily(item->Label()); fMapView->SetFontFamily(item->Label());
fMapView->Invalidate(); fMapView->Invalidate();
} }
} }
break; break;
case SYSTEM_MAP_SELECTED: case SYSTEM_MAP_SELECTED:
@ -302,13 +302,13 @@ KeymapWindow::MessageReceived( BMessage* message )
} }
break; break;
case USER_MAP_SELECTED: case USER_MAP_SELECTED:
{ {
KeymapListItem *keymapListItem = KeymapListItem *keymapListItem =
(KeymapListItem*)fUserListView->ItemAt(fUserListView->CurrentSelection()); (KeymapListItem*)fUserListView->ItemAt(fUserListView->CurrentSelection());
if (keymapListItem) { if (keymapListItem) {
fCurrentMap.Load(keymapListItem->KeymapEntry()); fCurrentMap.Load(keymapListItem->KeymapEntry());
fMapView->Invalidate(); fMapView->Invalidate();
// Deselect item in other BListView // Deselect item in other BListView
fSystemListView->DeselectAll(); fSystemListView->DeselectAll();
} }
@ -319,7 +319,7 @@ KeymapWindow::MessageReceived( BMessage* message )
break; break;
case REVERT: // do nothing, just like the original case REVERT: // do nothing, just like the original
break; break;
default: default:
BWindow::MessageReceived( message ); BWindow::MessageReceived( message );
break; break;
} }
@ -362,7 +362,7 @@ KeymapWindow::FillSystemMaps()
path.Append("Keymap"); path.Append("Keymap");
BDirectory directory; BDirectory directory;
entry_ref ref; entry_ref ref;
if (directory.SetTo(path.Path()) == B_OK) if (directory.SetTo(path.Path()) == B_OK)
@ -387,7 +387,7 @@ KeymapWindow::FillUserMaps()
entry_ref ref; entry_ref ref;
get_ref_for_path(path.Path(), &ref); get_ref_for_path(path.Path(), &ref);
fUserListView->AddItem(new KeymapListItem(ref, "(Current)")); fUserListView->AddItem(new KeymapListItem(ref, "(Current)"));
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK)
@ -422,7 +422,7 @@ MapView::MapView(BRect rect, const char *name, Keymap* keymap)
// TODO: Properly handle font sensitivity in drawing the keys. // TODO: Properly handle font sensitivity in drawing the keys.
// This at least prevents the app from looking horrible until the font sensitivity for this app // This at least prevents the app from looking horrible until the font sensitivity for this app
// can be done the Right Way. // can be done the Right Way.
if(fCurrentFont.Size() > 14) if (fCurrentFont.Size() > 14)
fCurrentFont.SetSize(14); fCurrentFont.SetSize(14);
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
@ -894,7 +894,7 @@ MapView::MapView(BRect rect, const char *name, Keymap* keymap)
for (uint32 j = 0; j<128; j++) for (uint32 j = 0; j<128; j++)
fKeysVertical[j] = false; fKeysVertical[j] = false;
fKeysVertical[0x5e] = true; fKeysVertical[0x5e] = true;
fActiveDeadKey = 0; fActiveDeadKey = 0;
@ -1061,7 +1061,7 @@ MapView::DrawLocks()
FillRect(lightRect.InsetByCopy(1,1)); FillRect(lightRect.InsetByCopy(1,1));
SetHighColor(64,64,64); SetHighColor(64,64,64);
DrawString("num", BPoint(lightRect.left-2, 65), &delta); DrawString("num", BPoint(lightRect.left-2, 65), &delta);
lightRect.OffsetBy(26,0); lightRect.OffsetBy(26,0);
SetHighColor(80,80,80); SetHighColor(80,80,80);
StrokeLine(lightRect.LeftBottom(), lightRect.RightBottom()); StrokeLine(lightRect.LeftBottom(), lightRect.RightBottom());
@ -1147,13 +1147,13 @@ MapView::DrawKey(uint32 keyCode)
SetHighColor(255,255,255); SetHighColor(255,255,255);
StrokeRect(r); StrokeRect(r);
rgb_color color6 = {96,96,96}; rgb_color color6 = {96,96,96};
AddLine(r.LeftBottom(), r.RightBottom(), color6); AddLine(r.LeftBottom(), r.RightBottom(), color6);
rgb_color color5 = {160,160,160}; rgb_color color5 = {160,160,160};
AddLine(r.LeftBottom(), r.LeftBottom(), color5); AddLine(r.LeftBottom(), r.LeftBottom(), color5);
rgb_color color7 = {64,64,64}; rgb_color color7 = {64,64,64};
AddLine(r.RightBottom(), BPoint(r.right, r.bottom-1), color7); AddLine(r.RightBottom(), BPoint(r.right, r.bottom-1), color7);
AddLine(BPoint(r.right, r.bottom-1), BPoint(r.right, r.top-1), color6); AddLine(BPoint(r.right, r.bottom-1), BPoint(r.right, r.top-1), color6);
AddLine(BPoint(r.right, r.top-1), r.RightTop(), color5); AddLine(BPoint(r.right, r.top-1), r.RightTop(), color5);
rgb_color color8 = {255,255,255}; rgb_color color8 = {255,255,255};
AddLine(BPoint(r.left+1, r.bottom-1), BPoint(r.left+2, r.bottom-1), color8); AddLine(BPoint(r.left+1, r.bottom-1), BPoint(r.left+2, r.bottom-1), color8);
@ -1166,16 +1166,16 @@ MapView::DrawKey(uint32 keyCode)
r.InsetBySelf(1,1); r.InsetBySelf(1,1);
r.bottom -= 1; r.bottom -= 1;
BRect fillRect = r; BRect fillRect = r;
if (!vertical) { if (!vertical) {
int32 w1 = 4; int32 w1 = 4;
int32 w2 = 3; int32 w2 = 3;
if(fKeysRect[keyCode].Width() > 20) { if (fKeysRect[keyCode].Width() > 20) {
w1 = 6; w1 = 6;
w2 = 6; w2 = 6;
} }
fillRect.right = fillRect.left + w1; fillRect.right = fillRect.left + w1;
SetHighColor(152,152,152); SetHighColor(152,152,152);
FillRect(fillRect); FillRect(fillRect);
fillRect.left += w1; fillRect.left += w1;
@ -1276,7 +1276,7 @@ MapView::DrawKey(uint32 keyCode)
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
} }
delete str; delete str;
} }
} }
@ -1329,7 +1329,7 @@ MapView::MessageReceived(BMessage *msg)
if ((msg->FindData("states", B_UINT8_TYPE, (const void **)&states, &size)!=B_OK) if ((msg->FindData("states", B_UINT8_TYPE, (const void **)&states, &size)!=B_OK)
|| (msg->FindInt32("modifiers", (int32 *)&info.modifiers)!=B_OK)) || (msg->FindInt32("modifiers", (int32 *)&info.modifiers)!=B_OK))
break; break;
if (fOldKeyInfo.modifiers != info.modifiers) { if (fOldKeyInfo.modifiers != info.modifiers) {
fOldKeyInfo.modifiers = info.modifiers; fOldKeyInfo.modifiers = info.modifiers;
for (int8 i=0; i<16; i++) for (int8 i=0; i<16; i++)
@ -1337,7 +1337,7 @@ MapView::MessageReceived(BMessage *msg)
InvalidateKeys(); InvalidateKeys();
DrawLocks(); DrawLocks();
} else { } else {
int32 keyCode = -1; int32 keyCode = -1;
for (int8 i=0; i<16; i++) for (int8 i=0; i<16; i++)
if (fOldKeyInfo.key_states[i] != states[i]) { if (fOldKeyInfo.key_states[i] != states[i]) {
@ -1348,7 +1348,6 @@ MapView::MessageReceived(BMessage *msg)
keyCode = i*8 + j; keyCode = i*8 + j;
DrawKey(keyCode); DrawKey(keyCode);
} }
} }
if (keyCode<0) if (keyCode<0)
@ -1361,10 +1360,10 @@ MapView::MessageReceived(BMessage *msg)
i = 16; i = 16;
break; break;
} }
} }
} }
if (Window()->IsActive() if (Window()->IsActive()
&& msg->what == B_KEY_DOWN) { && msg->what == B_KEY_DOWN) {
fTextView->MakeFocus(); fTextView->MakeFocus();
@ -1377,7 +1376,7 @@ MapView::MessageReceived(BMessage *msg)
} }
fActiveDeadKey = 0; fActiveDeadKey = 0;
InvalidateKeys(); InvalidateKeys();
} else { } else {
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, fActiveDeadKey, &str, &numBytes); fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, fActiveDeadKey, &str, &numBytes);
fActiveDeadKey = fCurrentMap->IsDeadKey(keyCode, fOldKeyInfo.modifiers); fActiveDeadKey = fCurrentMap->IsDeadKey(keyCode, fOldKeyInfo.modifiers);
if (fActiveDeadKey) if (fActiveDeadKey)
@ -1387,7 +1386,7 @@ MapView::MessageReceived(BMessage *msg)
} }
} }
delete str; delete str;
} }
} }
break; break;
} }
@ -1417,7 +1416,7 @@ MapView::MouseDown(BPoint point)
{ {
uint32 buttons; uint32 buttons;
GetMouse(&point, &buttons); GetMouse(&point, &buttons);
if(buttons & B_PRIMARY_MOUSE_BUTTON) { if (buttons & B_PRIMARY_MOUSE_BUTTON) {
fCurrentMouseKey = 0; fCurrentMouseKey = 0;
for (int32 i=0; i<128; i++) { for (int32 i=0; i<128; i++) {
if (fKeysRect[i].IsValid() && fKeysRect[i].Contains(point)) { if (fKeysRect[i].IsValid() && fKeysRect[i].Contains(point)) {

View File

@ -46,7 +46,7 @@ Media::Media()
rect.bottom = d; rect.bottom = d;
} }
} }
} }
} }
} }
@ -81,10 +81,10 @@ Media::MessageReceived(BMessage *message)
fWindow->PostMessage(message); fWindow->PostMessage(message);
break; break;
default: default:
BApplication::MessageReceived(message); BApplication::MessageReceived(message);
break; break;
} }
} }
@ -98,6 +98,6 @@ main(int, char**)
if (app.InitCheck() == B_OK) if (app.InitCheck() == B_OK)
app.Run(); app.Run();
return 0; return 0;
} }

View File

@ -86,26 +86,26 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
BRect iconFrame(frame); BRect iconFrame(frame);
iconFrame.Set(iconFrame.left, iconFrame.top+1, iconFrame.left+15, iconFrame.top+16); iconFrame.Set(iconFrame.left, iconFrame.top+1, iconFrame.left+15, iconFrame.top+16);
uint32 index = 0; uint32 index = 0;
if(OutlineLevel()==0 || (fIsDefaultInput && fIsDefaultOutput)) { if (OutlineLevel()==0 || (fIsDefaultInput && fIsDefaultOutput)) {
if(fIsDefaultInput && fIsVideo) if (fIsDefaultInput && fIsVideo)
index = 4; index = 4;
else if(fIsDefaultInput && !fIsVideo) else if (fIsDefaultInput && !fIsVideo)
index = 2; index = 2;
owner->SetDrawingMode(B_OP_OVER); owner->SetDrawingMode(B_OP_OVER);
owner->DrawBitmap(static_cast<BBitmap*>(fIcons->ItemAt(index)), iconFrame); owner->DrawBitmap(static_cast<BBitmap*>(fIcons->ItemAt(index)), iconFrame);
owner->SetDrawingMode(B_OP_COPY); owner->SetDrawingMode(B_OP_COPY);
} }
iconFrame.OffsetBy(16, 0); iconFrame.OffsetBy(16, 0);
if(fIsDefaultInput || fIsDefaultOutput || fIsAudioMixer) { if (fIsDefaultInput || fIsDefaultOutput || fIsAudioMixer) {
if(fIsAudioMixer) if (fIsAudioMixer)
index = 1; index = 1;
else if(fIsDefaultOutput) { else if (fIsDefaultOutput) {
if(fIsVideo) if (fIsVideo)
index = 5; index = 5;
else else
index = 3; index = 3;
} else { } else {
if(fIsVideo) if (fIsVideo)
index = 4; index = 4;
else else
index = 2; index = 2;
@ -131,7 +131,7 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
void void
MediaListItem::SetDefault(bool isDefault, bool isInput) MediaListItem::SetDefault(bool isDefault, bool isInput)
{ {
if(isInput) if (isInput)
fIsDefaultInput = isDefault; fIsDefaultInput = isDefault;
else else
fIsDefaultOutput = isDefault; fIsDefaultOutput = isDefault;
@ -159,11 +159,11 @@ MediaListItem::Compare(const void *firstArg, const void *secondArg)
{ {
const MediaListItem *item1 = *static_cast<const MediaListItem * const *>(firstArg); const MediaListItem *item1 = *static_cast<const MediaListItem * const *>(firstArg);
const MediaListItem *item2 = *static_cast<const MediaListItem * const *>(secondArg); const MediaListItem *item2 = *static_cast<const MediaListItem * const *>(secondArg);
if(item1->fIsVideo != item2->fIsVideo) if (item1->fIsVideo != item2->fIsVideo)
return item1->fIsVideo ? 1 : -1; return item1->fIsVideo ? 1 : -1;
if(item1->OutlineLevel()!=item2->OutlineLevel()) if (item1->OutlineLevel()!=item2->OutlineLevel())
return item1->OutlineLevel()>item2->OutlineLevel() ? 1 : -1; return item1->OutlineLevel()>item2->OutlineLevel() ? 1 : -1;
if(item1->fIsAudioMixer!=item2->fIsAudioMixer) if (item1->fIsAudioMixer!=item2->fIsAudioMixer)
return item2->fIsAudioMixer ? 1 : -1; return item2->fIsAudioMixer ? 1 : -1;
return strcmp(item1->fLabel, item2->fLabel); return strcmp(item1->fLabel, item2->fLabel);
} }

View File

@ -39,7 +39,7 @@ BarView::Draw(BRect updateRect)
{ {
BRect r = Bounds(); BRect r = Bounds();
if(fDisplay) { if (fDisplay) {
// Display the 3D Look Divider Bar // Display the 3D Look Divider Bar
SetHighColor(140,140,140,0); SetHighColor(140,140,140,0);
StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top)); StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top));
@ -84,7 +84,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
defaultsBox->AddChild(menuField2); defaultsBox->AddChild(menuField2);
menuField2->SetDivider(divider); menuField2->SetDivider(divider);
if(!fIsVideo) { if (!fIsVideo) {
defaultRect.OffsetBy(186, 0); defaultRect.OffsetBy(186, 0);
defaultRect.right -= 30; defaultRect.right -= 30;
fMenu3 = new BPopUpMenu("<none>"); fMenu3 = new BPopUpMenu("<none>");
@ -121,7 +121,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
uint32 flags; uint32 flags;
BMediaRoster::Roster()->GetRealtimeFlags(&flags); BMediaRoster::Roster()->GetRealtimeFlags(&flags);
if(flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO)) if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
fRealtimeCheckBox->SetValue(B_CONTROL_ON); fRealtimeCheckBox->SetValue(B_CONTROL_ON);
rect2.top += 26; rect2.top += 26;
@ -145,7 +145,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
"Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER)); "Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER));
AddChild(restartButton); AddChild(restartButton);
if(!fIsVideo) { if (!fIsVideo) {
rect.right = rect.left - 10; rect.right = rect.left - 10;
rect.top += 4; rect.top += 4;
rect.left = frame.left + 33; rect.left = frame.left + 33;
@ -156,7 +156,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
"Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL)); "Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL));
AddChild(fVolumeCheckBox); AddChild(fVolumeCheckBox);
if(BDeskbar().HasItem("MediaReplicant")) if (BDeskbar().HasItem("MediaReplicant"))
fVolumeCheckBox->SetValue(B_CONTROL_ON); fVolumeCheckBox->SetValue(B_CONTROL_ON);
} }
} }
@ -186,7 +186,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
for (int32 i = 0; i < menu->CountItems(); i++) { for (int32 i = 0; i < menu->CountItems(); i++) {
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i)); SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
if(item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) { if (item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
item->SetMarked(true); item->SetMarked(true);
break; break;
} }
@ -215,7 +215,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
media_input *input = new media_input(); media_input *input = new media_input();
memcpy(input, &inputs[i], sizeof(*input)); memcpy(input, &inputs[i], sizeof(*input));
fMenu3->AddItem(item = new Settings2Item(&info, input, new BMessage(message))); fMenu3->AddItem(item = new Settings2Item(&info, input, new BMessage(message)));
if(inputs[i].destination.id == outputID) if (inputs[i].destination.id == outputID)
item->SetMarked(true); item->SetMarked(true);
} }
} }

View File

@ -30,9 +30,9 @@ const uint32 ML_DEFAULTOUTPUT_CHANGE = 'doch';
class BarView : public BView class BarView : public BView
{ {
public: public:
BarView(BRect frame); BarView(BRect frame);
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
bool fDisplay; bool fDisplay;
}; };
class SettingsItem : public BMenuItem class SettingsItem : public BMenuItem
@ -58,18 +58,18 @@ class Settings2Item : public BMenuItem
class SettingsView : public BView class SettingsView : public BView
{ {
public: public:
SettingsView(BRect frame, bool isVideo); SettingsView(BRect frame, bool isVideo);
void AddNodes(BList &list, bool isInput); void AddNodes(BList &list, bool isInput);
void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1); void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1);
BCheckBox *fRealtimeCheckBox; BCheckBox *fRealtimeCheckBox;
BCheckBox *fVolumeCheckBox; BCheckBox *fVolumeCheckBox;
BMenu *fMenu1; BMenu *fMenu1;
BMenu *fMenu2; BMenu *fMenu2;
BMenu *fMenu3; BMenu *fMenu3;
BStringView *fRestartView; BStringView *fRestartView;
private: private:
bool fIsVideo; bool fIsVideo;
}; };
#endif #endif

View File

@ -53,29 +53,29 @@ MediaWindow::InitCheck()
// MediaWindow - Destructor // MediaWindow - Destructor
MediaWindow::~MediaWindow() MediaWindow::~MediaWindow()
{ {
for(int i=0; i<fAudioOutputs.CountItems(); i++) for (int i=0; i<fAudioOutputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fAudioOutputs.ItemAt(i)); delete static_cast<dormant_node_info *>(fAudioOutputs.ItemAt(i));
for(int i=0; i<fAudioInputs.CountItems(); i++) for (int i=0; i<fAudioInputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fAudioInputs.ItemAt(i)); delete static_cast<dormant_node_info *>(fAudioInputs.ItemAt(i));
for(int i=0; i<fVideoOutputs.CountItems(); i++) for (int i=0; i<fVideoOutputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i)); delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i));
for(int i=0; i<fVideoInputs.CountItems(); i++) for (int i=0; i<fVideoInputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i)); delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i));
BMediaRoster *roster = BMediaRoster::Roster(); BMediaRoster *roster = BMediaRoster::Roster();
if(roster && fCurrentNode) if (roster && fCurrentNode)
roster->ReleaseNode(*fCurrentNode); roster->ReleaseNode(*fCurrentNode);
char buffer[512]; char buffer[512];
BRect rect = Frame(); BRect rect = Frame();
PRINT_OBJECT(rect); PRINT_OBJECT(rect);
sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n", int(rect.left), int(rect.top), int(rect.right), int(rect.bottom)); sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n", int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
BPath path; BPath path;
if(find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(SETTINGS_FILE); path.Append(SETTINGS_FILE);
BFile file(path.Path(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE); BFile file(path.Path(), B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
if(file.InitCheck()==B_OK) { if (file.InitCheck()==B_OK) {
file.Write(buffer, strlen(buffer)); file.Write(buffer, strlen(buffer));
} }
} }
@ -92,19 +92,19 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
BMediaRoster *roster = BMediaRoster::Roster(); BMediaRoster *roster = BMediaRoster::Roster();
format.type = type; format.type = type;
if(kind & B_PHYSICAL_OUTPUT) if (kind & B_PHYSICAL_OUTPUT)
format1 = &format; format1 = &format;
else if(kind & B_PHYSICAL_INPUT) else if (kind & B_PHYSICAL_INPUT)
format2 = &format; format2 = &format;
else else
return; return;
if(roster->GetDormantNodes(node_info, &node_info_count, format1, format2, NULL, kind)!=B_OK) { if (roster->GetDormantNodes(node_info, &node_info_count, format1, format2, NULL, kind)!=B_OK) {
fprintf(stderr, "error\n"); fprintf(stderr, "error\n");
return; return;
} }
for(int32 i=0; i<node_info_count; i++) { for (int32 i=0; i<node_info_count; i++) {
PRINT(("node : %s, media_addon %i, flavor_id %i\n", PRINT(("node : %s, media_addon %i, flavor_id %i\n",
node_info[i].name, node_info[i].addon, node_info[i].flavor_id)); node_info[i].name, node_info[i].addon, node_info[i].flavor_id));
dormant_node_info *info = new dormant_node_info(); dormant_node_info *info = new dormant_node_info();
@ -119,9 +119,9 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
MediaListItem * MediaListItem *
MediaWindow::FindMediaListItem(dormant_node_info *info) MediaWindow::FindMediaListItem(dormant_node_info *info)
{ {
for(int32 j=0; j<fListView->CountItems(); j++) { for (int32 j=0; j<fListView->CountItems(); j++) {
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(j)); MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(j));
if(item->fInfo && item->fInfo->addon == info->addon && item->fInfo->flavor_id == info->flavor_id) { if (item->fInfo && item->fInfo->addon == info->addon && item->fInfo->flavor_id == info->flavor_id) {
return item; return item;
break; break;
} }
@ -133,9 +133,9 @@ MediaWindow::FindMediaListItem(dormant_node_info *info)
void void
MediaWindow::AddNodes(BList &list, bool isVideo) MediaWindow::AddNodes(BList &list, bool isVideo)
{ {
for(int32 i=0; i<list.CountItems(); i++) { for (int32 i=0; i<list.CountItems(); i++) {
dormant_node_info *info = static_cast<dormant_node_info *>(list.ItemAt(i)); dormant_node_info *info = static_cast<dormant_node_info *>(list.ItemAt(i));
if(!FindMediaListItem(info)) if (!FindMediaListItem(info))
fListView->AddItem(new MediaListItem(info, 1, isVideo, &fIcons)); fListView->AddItem(new MediaListItem(info, 1, isVideo, &fIcons));
} }
} }
@ -144,12 +144,12 @@ MediaWindow::AddNodes(BList &list, bool isVideo)
// MediaWindow::InitWindow -- Initialization Commands here // MediaWindow::InitWindow -- Initialization Commands here
void void
MediaWindow::InitWindow(void) MediaWindow::InitWindow(void)
{ {
// Bitmaps // Bitmaps
BRect iconRect(0,0,15,15); BRect iconRect(0, 0, 15, 15);
BBitmap *icon = new BBitmap(iconRect, B_CMAP8); BBitmap *icon = new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace); icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace);
fIcons.AddItem(icon); fIcons.AddItem(icon);
icon = new BBitmap(iconRect, B_CMAP8); icon = new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace); icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace);
fIcons.AddItem(icon); fIcons.AddItem(icon);
@ -170,18 +170,18 @@ MediaWindow::InitWindow(void)
BRect bounds = Bounds(); // the whole view BRect bounds = Bounds(); // the whole view
// Create the OutlineView // Create the OutlineView
BRect menuRect(bounds.left+14,bounds.top+14,bounds.left+146,bounds.bottom-14); BRect menuRect(bounds.left+14, bounds.top+14, bounds.left+146, bounds.bottom-14);
BRect titleRect(menuRect.right+14,menuRect.top,bounds.right-10,menuRect.top+16); BRect titleRect(menuRect.right+14, menuRect.top, bounds.right-10, menuRect.top+16);
BRect availableRect(menuRect.right+15,titleRect.bottom+12,bounds.right-14,bounds.bottom-4); BRect availableRect(menuRect.right+15, titleRect.bottom+12, bounds.right-14, bounds.bottom-4);
BRect barRect(titleRect.left,titleRect.bottom+10,titleRect.right-2,titleRect.bottom+11); BRect barRect(titleRect.left, titleRect.bottom+10, titleRect.right-2, titleRect.bottom+11);
fListView = new BListView(menuRect, "media_list_view", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES); fListView = new BListView(menuRect, "media_list_view", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE)); fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
// Add ScrollView to Media Menu // Add ScrollView to Media Menu
BScrollView *scrollView = new BScrollView("listscroller", fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, B_FANCY_BORDER); BScrollView *scrollView = new BScrollView("listscroller", fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, B_FANCY_BORDER);
// Create the Views // Create the Views
fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER); fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
// Add Child(ren) // Add Child(ren)
@ -189,7 +189,7 @@ MediaWindow::InitWindow(void)
fBox->AddChild(scrollView); fBox->AddChild(scrollView);
// StringViews // StringViews
rgb_color titleFontColor = { 0,0,0,0 }; rgb_color titleFontColor = { 0,0,0,0 };
fTitleView = new BStringView(titleRect, "AudioSettings", "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); fTitleView = new BStringView(titleRect, "AudioSettings", "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
fTitleView->SetFont(be_bold_font); fTitleView->SetFont(be_bold_font);
fTitleView->SetFontSize(12.0); fTitleView->SetFontSize(12.0);
@ -223,48 +223,48 @@ MediaWindow::InitMedia(bool first)
status_t err = B_OK; status_t err = B_OK;
BMediaRoster *roster = BMediaRoster::Roster(&err); BMediaRoster *roster = BMediaRoster::Roster(&err);
if(first && err != B_OK) { if (first && err != B_OK) {
BAlert *alert = new BAlert("start_media_server", BAlert *alert = new BAlert("start_media_server",
"Could not connect to the Media Server.\n" "Could not connect to the Media Server.\n"
"Would you like to start it ?", "Quit", "Start Media Server", NULL, "Would you like to start it ?", "Quit", "Start Media Server", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if(alert->Go()==0) if (alert->Go()==0)
return B_ERROR; return B_ERROR;
fAlert = new MediaAlert(BRect(0,0,300,60), fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", "Restarting Media Services\nStarting Media Server...\n"); "restart_alert", "Restarting Media Services\nStarting Media Server...\n");
fAlert->Show(); fAlert->Show();
Show(); Show();
launch_media_server(); launch_media_server();
} }
Lock(); Lock();
bool isVideoSelected = true; bool isVideoSelected = true;
if(!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected()) if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
isVideoSelected = false; isVideoSelected = false;
if((!first || (first && err) ) && fAlert) { if ((!first || (first && err) ) && fAlert) {
BAutolock locker(fAlert); BAutolock locker(fAlert);
if(locker.IsLocked()) if (locker.IsLocked())
fAlert->TextView()->SetText("Ready For Use..."); fAlert->TextView()->SetText("Ready For Use...");
} }
void *listItem; void *listItem;
while((listItem = fListView->RemoveItem((int32)0))) while ((listItem = fListView->RemoveItem((int32)0)))
delete static_cast<MediaListItem *>(listItem); delete static_cast<MediaListItem *>(listItem);
while((listItem = fAudioOutputs.RemoveItem((int32)0))) while ((listItem = fAudioOutputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem); delete static_cast<dormant_node_info *>(listItem);
while((listItem = fAudioInputs.RemoveItem((int32)0))) while ((listItem = fAudioInputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem); delete static_cast<dormant_node_info *>(listItem);
while((listItem = fVideoOutputs.RemoveItem((int32)0))) while ((listItem = fVideoOutputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem); delete static_cast<dormant_node_info *>(listItem);
while((listItem = fVideoInputs.RemoveItem((int32)0))) while ((listItem = fVideoInputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem); delete static_cast<dormant_node_info *>(listItem);
MediaListItem *item, *mixer, *audio, *video; MediaListItem *item, *mixer, *audio, *video;
// Grab Media Info // Grab Media Info
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_OUTPUT, fAudioOutputs); FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_OUTPUT, fAudioOutputs);
@ -292,62 +292,62 @@ MediaWindow::InitMedia(bool first)
fListView->AddItem(video = new MediaListItem("Video Settings", 0, true, &fIcons)); fListView->AddItem(video = new MediaListItem("Video Settings", 0, true, &fIcons));
fListView->AddItem(mixer = new MediaListItem("Audio Mixer", 1, false, &fIcons)); fListView->AddItem(mixer = new MediaListItem("Audio Mixer", 1, false, &fIcons));
mixer->SetAudioMixer(true); mixer->SetAudioMixer(true);
fListView->SortItems(&MediaListItem::Compare); fListView->SortItems(&MediaListItem::Compare);
media_node default_node; media_node default_node;
dormant_node_info node_info; dormant_node_info node_info;
int32 outputID; int32 outputID;
BString outputName; BString outputName;
if(roster->GetAudioInput(&default_node)==B_OK) { if (roster->GetAudioInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info); roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info); item = FindMediaListItem(&node_info);
if(item) if (item)
item->SetDefault(true, true); item->SetDefault(true, true);
fAudioView->SetDefault(node_info, true); fAudioView->SetDefault(node_info, true);
} }
if(roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) { if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info); roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info); item = FindMediaListItem(&node_info);
if(item) if (item)
item->SetDefault(true, false); item->SetDefault(true, false);
fAudioView->SetDefault(node_info, false, outputID); fAudioView->SetDefault(node_info, false, outputID);
} }
if(roster->GetVideoInput(&default_node)==B_OK) { if (roster->GetVideoInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info); roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info); item = FindMediaListItem(&node_info);
if(item) if (item)
item->SetDefault(true, true); item->SetDefault(true, true);
fVideoView->SetDefault(node_info, true); fVideoView->SetDefault(node_info, true);
} }
if(roster->GetVideoOutput(&default_node)==B_OK) { if (roster->GetVideoOutput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info); roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info); item = FindMediaListItem(&node_info);
if(item) if (item)
item->SetDefault(true, false); item->SetDefault(true, false);
fVideoView->SetDefault(node_info, false); fVideoView->SetDefault(node_info, false);
} }
if(first) { if (first) {
fListView->Select(fListView->IndexOf(mixer)); fListView->Select(fListView->IndexOf(mixer));
} else { } else {
if(!fAudioView->fRestartView->IsHidden()) if (!fAudioView->fRestartView->IsHidden())
fAudioView->fRestartView->Hide(); fAudioView->fRestartView->Hide();
if(!fVideoView->fRestartView->IsHidden()) if (!fVideoView->fRestartView->IsHidden())
fVideoView->fRestartView->Hide(); fVideoView->fRestartView->Hide();
if(isVideoSelected) if (isVideoSelected)
fListView->Select(fListView->IndexOf(video)); fListView->Select(fListView->IndexOf(video));
else else
fListView->Select(fListView->IndexOf(audio)); fListView->Select(fListView->IndexOf(audio));
} }
if(fAlert) { if (fAlert) {
snooze(800000); snooze(800000);
fAlert->PostMessage(B_QUIT_REQUESTED); fAlert->PostMessage(B_QUIT_REQUESTED);
} }
@ -400,52 +400,52 @@ void
MediaWindow::MessageReceived (BMessage *message) MediaWindow::MessageReceived (BMessage *message)
{ {
switch(message->what) switch(message->what)
{ {
case ML_INIT_MEDIA: case ML_INIT_MEDIA:
InitMedia(false); InitMedia(false);
break; break;
case ML_DEFAULTOUTPUT_CHANGE: case ML_DEFAULTOUTPUT_CHANGE:
{ {
int32 index; int32 index;
if(message->FindInt32("index", &index)!=B_OK) if (message->FindInt32("index", &index)!=B_OK)
break; break;
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index)); Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
if(item) { if (item) {
BMediaRoster *roster = BMediaRoster::Roster(); BMediaRoster *roster = BMediaRoster::Roster();
roster->SetAudioOutput(*item->fInput); roster->SetAudioOutput(*item->fInput);
if(fAudioView->fRestartView->IsHidden()) if (fAudioView->fRestartView->IsHidden())
fAudioView->fRestartView->Show(); fAudioView->fRestartView->Show();
} else } else
fprintf(stderr, "Settings2Item not found\n"); fprintf(stderr, "Settings2Item not found\n");
} }
break; break;
case ML_DEFAULT_CHANGE: case ML_DEFAULT_CHANGE:
{ {
bool isVideo = true; bool isVideo = true;
bool isInput = true; bool isInput = true;
if(message->FindBool("isVideo", &isVideo)!=B_OK) if (message->FindBool("isVideo", &isVideo)!=B_OK)
break; break;
if(message->FindBool("isInput", &isInput)!=B_OK) if (message->FindBool("isInput", &isInput)!=B_OK)
break; break;
int32 index; int32 index;
if(message->FindInt32("index", &index)!=B_OK) if (message->FindInt32("index", &index)!=B_OK)
break; break;
SettingsView *settingsView = isVideo ? fVideoView : fAudioView; SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2; BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index)); SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
if(item) { if (item) {
PRINT(("isVideo %i isInput %i\n", isVideo, isInput)); PRINT(("isVideo %i isInput %i\n", isVideo, isInput));
BMediaRoster *roster = BMediaRoster::Roster(); BMediaRoster *roster = BMediaRoster::Roster();
if(isVideo) { if (isVideo) {
if(isInput) if (isInput)
roster->SetVideoInput(*item->fInfo); roster->SetVideoInput(*item->fInfo);
else else
roster->SetVideoOutput(*item->fInfo); roster->SetVideoOutput(*item->fInfo);
} else { } else {
if(isInput) if (isInput)
roster->SetAudioInput(*item->fInfo); roster->SetAudioInput(*item->fInfo);
else { else {
roster->SetAudioOutput(*item->fInfo); roster->SetAudioOutput(*item->fInfo);
@ -454,28 +454,28 @@ MediaWindow::MessageReceived (BMessage *message)
} }
MediaListItem *oldListItem = NULL; MediaListItem *oldListItem = NULL;
for(int32 j=0; j<fListView->CountItems(); j++) { for (int32 j=0; j<fListView->CountItems(); j++) {
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j)); oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
if(oldListItem->fInfo && oldListItem->IsVideo() == isVideo if (oldListItem->fInfo && oldListItem->IsVideo() == isVideo
&& oldListItem->IsDefault(isInput)) && oldListItem->IsDefault(isInput))
break; break;
} }
if(oldListItem) if (oldListItem)
oldListItem->SetDefault(false, isInput); oldListItem->SetDefault(false, isInput);
else else
fprintf(stderr, "oldListItem not found\n"); fprintf(stderr, "oldListItem not found\n");
MediaListItem *listItem = FindMediaListItem(item->fInfo); MediaListItem *listItem = FindMediaListItem(item->fInfo);
if(listItem) { if (listItem) {
listItem->SetDefault(true, isInput); listItem->SetDefault(true, isInput);
} else } else
fprintf(stderr, "MediaListItem not found\n"); fprintf(stderr, "MediaListItem not found\n");
fListView->Invalidate(); fListView->Invalidate();
if(settingsView->fRestartView->IsHidden()) if (settingsView->fRestartView->IsHidden())
settingsView->fRestartView->Show(); settingsView->fRestartView->Show();
} else } else
fprintf(stderr, "SettingsItem not found\n"); fprintf(stderr, "SettingsItem not found\n");
} }
break; break;
case ML_RESTART_MEDIA_SERVER: case ML_RESTART_MEDIA_SERVER:
@ -515,14 +515,14 @@ MediaWindow::MessageReceived (BMessage *message)
case ML_ENABLE_REAL_TIME: case ML_ENABLE_REAL_TIME:
{ {
bool isVideo = true; bool isVideo = true;
if(message->FindBool("isVideo", &isVideo)!=B_OK) if (message->FindBool("isVideo", &isVideo)!=B_OK)
break; break;
SettingsView *settingsView = isVideo ? fVideoView : fAudioView; SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
uint32 flags; uint32 flags;
uint32 realtimeFlag = isVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO; uint32 realtimeFlag = isVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO;
BMediaRoster *roster = BMediaRoster::Roster(); BMediaRoster *roster = BMediaRoster::Roster();
roster->GetRealtimeFlags(&flags); roster->GetRealtimeFlags(&flags);
if(settingsView->fRealtimeCheckBox->Value()==B_CONTROL_ON) if (settingsView->fRealtimeCheckBox->Value()==B_CONTROL_ON)
flags |= realtimeFlag; flags |= realtimeFlag;
else else
flags &= ~realtimeFlag; flags &= ~realtimeFlag;
@ -535,50 +535,49 @@ MediaWindow::MessageReceived (BMessage *message)
PRINT_OBJECT(*message); PRINT_OBJECT(*message);
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection())); MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
if(!item) if (!item)
break; break;
BMediaRoster* roster = BMediaRoster::Roster(); BMediaRoster* roster = BMediaRoster::Roster();
if(fCurrentNode) { if (fCurrentNode) {
// stop watching the MediaRoster // stop watching the MediaRoster
roster->StopWatching(this, *fCurrentNode, B_MEDIA_WILDCARD); roster->StopWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
roster->ReleaseNode(*fCurrentNode); roster->ReleaseNode(*fCurrentNode);
} }
fCurrentNode = NULL; fCurrentNode = NULL;
BView *paramView = fContentView->ChildAt(0); BView *paramView = fContentView->ChildAt(0);
if(paramView!=NULL) { if (paramView!=NULL) {
fContentView->RemoveChild(paramView); fContentView->RemoveChild(paramView);
} }
paramView = NULL; paramView = NULL;
if(fParamWeb) if (fParamWeb)
delete fParamWeb; delete fParamWeb;
fParamWeb = NULL; fParamWeb = NULL;
fTitleView->SetText(item->GetLabel()); fTitleView->SetText(item->GetLabel());
if(item->OutlineLevel() == 0) { if (item->OutlineLevel() == 0) {
if(item->IsVideo()) if (item->IsVideo())
fContentView->AddChild(fVideoView); fContentView->AddChild(fVideoView);
else else
fContentView->AddChild(fAudioView); fContentView->AddChild(fAudioView);
} else { } else {
if(!fCurrentNode) if (!fCurrentNode)
fCurrentNode = new media_node(); fCurrentNode = new media_node();
media_node_id node_id; media_node_id node_id;
if(item->IsAudioMixer()) if (item->IsAudioMixer())
roster->GetAudioMixer(fCurrentNode); roster->GetAudioMixer(fCurrentNode);
else if(roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK) else if (roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK)
roster->InstantiateDormantNode(*(item->fInfo), fCurrentNode, B_FLAVOR_IS_GLOBAL); roster->InstantiateDormantNode(*(item->fInfo), fCurrentNode, B_FLAVOR_IS_GLOBAL);
else else
roster->GetNodeFor(node_id, fCurrentNode); roster->GetNodeFor(node_id, fCurrentNode);
if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
&& (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) { && (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
fContentView->AddChild(paramView); fContentView->AddChild(paramView);
paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10); paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD); roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
} else { } else {
if (fParamWeb) if (fParamWeb)
delete fParamWeb; delete fParamWeb;
@ -594,7 +593,7 @@ MediaWindow::MessageReceived (BMessage *message)
} }
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2); bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
if(barChanged != fBar->fDisplay) { if (barChanged != fBar->fDisplay) {
fBar->fDisplay = barChanged; fBar->fDisplay = barChanged;
fBar->Invalidate(); fBar->Invalidate();
} }
@ -604,24 +603,24 @@ MediaWindow::MessageReceived (BMessage *message)
{ {
PRINT_OBJECT(*message); PRINT_OBJECT(*message);
const char *mimeSig; const char *mimeSig;
if(fAlert && message->FindString("be:signature", &mimeSig)==B_OK if (fAlert && message->FindString("be:signature", &mimeSig)==B_OK
&& (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0 && (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) { || strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) {
fAlert->Lock(); fAlert->Lock();
fAlert->TextView()->SetText("Starting Media Server..."); fAlert->TextView()->SetText("Starting Media Server...");
fAlert->Unlock(); fAlert->Unlock();
} }
} }
break; break;
case B_SOME_APP_QUIT: case B_SOME_APP_QUIT:
{ {
PRINT_OBJECT(*message); PRINT_OBJECT(*message);
const char *mimeSig; const char *mimeSig;
if(message->FindString("be:signature", &mimeSig)==B_OK) { if (message->FindString("be:signature", &mimeSig)==B_OK) {
if(strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0 if (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0) { || strcmp(mimeSig, "application/x-vnd.Be.media-server")==0) {
BMediaRoster* roster = BMediaRoster::CurrentRoster(); BMediaRoster* roster = BMediaRoster::CurrentRoster();
if(roster&&roster->Lock()) if (roster&&roster->Lock())
roster->Quit(); roster->Quit();
} }
} }
@ -638,16 +637,16 @@ status_t
MediaWindow::RestartMediaServices(void *data) MediaWindow::RestartMediaServices(void *data)
{ {
MediaWindow *window = (MediaWindow *)data; MediaWindow *window = (MediaWindow *)data;
window->fAlert = new MediaAlert(BRect(0,0,300,60), window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", "Restarting Media Services\nShutting down Media Server\n"); "restart_alert", "Restarting Media Services\nShutting down Media Server\n");
window->fAlert->Show(); window->fAlert->Show();
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert); shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert);
{ {
BAutolock locker(window->fAlert); BAutolock locker(window->fAlert);
if(locker.IsLocked()) if (locker.IsLocked())
window->fAlert->TextView()->SetText("Starting Media Server..."); window->fAlert->TextView()->SetText("Starting Media Server...");
} }
launch_media_server(); launch_media_server();

View File

@ -32,7 +32,7 @@
class MediaWindow : public BWindow class MediaWindow : public BWindow
{ {
public: public:
MediaWindow(BRect frame); MediaWindow(BRect frame);
~MediaWindow(); ~MediaWindow();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
@ -49,14 +49,14 @@ class MediaWindow : public BWindow
BBox * fBox; BBox * fBox;
BListView* fListView; BListView* fListView;
BStringView* fTitleView; BStringView* fTitleView;
BView* fContentView; BView* fContentView;
SettingsView* fAudioView; SettingsView* fAudioView;
SettingsView* fVideoView; SettingsView* fVideoView;
BarView* fBar; BarView* fBar;
media_node* fCurrentNode; media_node* fCurrentNode;
BParameterWeb* fParamWeb; BParameterWeb* fParamWeb;
BList fAudioInputs; BList fAudioInputs;
BList fAudioOutputs; BList fAudioOutputs;

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Media", short_info = "Media",
long_info = "Media ©2003-2006 Haiku" long_info = "Media ©2003-2006 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;

View File

@ -15,7 +15,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Menu", short_info = "Menu",
long_info = "Menu ©2002-2007 Haiku" long_info = "Menu ©2002-2007 Haiku"
}; };
resource(1, "BEOS:FILE_TYPES") message; resource(1, "BEOS:FILE_TYPES") message;

View File

@ -15,7 +15,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "Screen", short_info = "Screen",
long_info = "Screen ©2001-2006 Haiku" long_info = "Screen ©2001-2006 Haiku"
}; };
#ifdef HAIKU_TARGET_PLATFORM_HAIKU #ifdef HAIKU_TARGET_PLATFORM_HAIKU

View File

@ -32,8 +32,8 @@ class ScreenSaverApp : public BApplication {
ScreenSaverApp::ScreenSaverApp() ScreenSaverApp::ScreenSaverApp()
: BApplication("application/x-vnd.Haiku-ScreenSaver") : BApplication("application/x-vnd.Haiku-ScreenSaver")
{ {
fScreenSaverWindow = new ScreenSaverWindow(); fScreenSaverWindow = new ScreenSaverWindow();
fScreenSaverWindow->Show(); fScreenSaverWindow->Show();
} }

View File

@ -488,7 +488,7 @@ ModulesView::_OpenSaver()
{ {
// create new screen saver preview & config // create new screen saver preview & config
BView* view = fPreviewView->AddPreview(); BView* view = fPreviewView->AddPreview();
fCurrentName = fSettings.ModuleName(); fCurrentName = fSettings.ModuleName();
fSaverRunner = new ScreenSaverRunner(Window(), view, true, fSettings); fSaverRunner = new ScreenSaverRunner(Window(), view, true, fSettings);
BScreenSaver* saver = _ScreenSaver(); BScreenSaver* saver = _ScreenSaver();
@ -890,7 +890,7 @@ ScreenSaverWindow::MessageReceived(BMessage *msg)
default: default:
BWindow::MessageReceived(msg); BWindow::MessageReceived(msg);
break; break;
} }
} }

View File

@ -64,7 +64,7 @@ HEventList::SetType(const char* type)
BString name; BString name;
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())); AddItem(new HEventItem(name.String(), path.Path()));
} }
@ -77,7 +77,7 @@ void
HEventList::RemoveAll() HEventList::RemoveAll()
{ {
BListItem *item; BListItem *item;
while((item = RemoveItem((int32)0))!=NULL) while ((item = RemoveItem((int32)0))!=NULL)
delete item; delete item;
MakeEmpty(); MakeEmpty();
} }
@ -92,17 +92,16 @@ HEventList::SelectionChanged()
BListView::SelectionChanged(); BListView::SelectionChanged();
int32 sel = CurrentSelection(); int32 sel = CurrentSelection();
if(sel >= 0) if (sel >= 0) {
{
HEventItem *item = cast_as(ItemAt(sel),HEventItem); HEventItem *item = cast_as(ItemAt(sel),HEventItem);
if(!item) if (!item)
return; return;
entry_ref ref; entry_ref ref;
BMediaFiles().GetRefFor(fType, item->Name(), &ref); BMediaFiles().GetRefFor(fType, item->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()); item->SetPath(path.Path());
InvalidateItem(sel); InvalidateItem(sel);
} else { } else {
@ -126,9 +125,9 @@ void
HEventList::SetPath(const char* path) HEventList::SetPath(const char* path)
{ {
int32 sel = CurrentSelection(); int32 sel = CurrentSelection();
if(sel >= 0) { if (sel >= 0) {
HEventItem *item = cast_as(ItemAt(sel),HEventItem); HEventItem *item = cast_as(ItemAt(sel),HEventItem);
if(!item) if (!item)
return; return;
entry_ref ref; entry_ref ref;

View File

@ -182,16 +182,16 @@ HWindow::MessageReceived(BMessage *message)
BMenu *menu = menufield->Menu(); BMenu *menu = menufield->Menu();
int32 sel = fEventList->CurrentSelection(); int32 sel = fEventList->CurrentSelection();
if(sel >= 0) { if (sel >= 0) {
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
BPath path(item->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)
item->SetMarked(true); item->SetMarked(true);
} else{ } else{
BMenuItem *item = menu->FindItem(path.Leaf()); BMenuItem *item = menu->FindItem(path.Leaf());
if(item) if (item)
item->SetMarked(true); item->SetMarked(true);
} }
} }
@ -203,7 +203,7 @@ HWindow::MessageReceived(BMessage *message)
{ {
entry_ref ref; entry_ref ref;
int32 sel = fEventList->CurrentSelection(); int32 sel = fEventList->CurrentSelection();
if(message->FindRef("refs", &ref) == B_OK && sel >= 0) { if (message->FindRef("refs", &ref) == B_OK && sel >= 0) {
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
BMenu *menu = menufield->Menu(); BMenu *menu = menufield->Menu();
// check audio file // check audio file
@ -225,12 +225,12 @@ HWindow::MessageReceived(BMessage *message)
BPath path(&ref); BPath path(&ref);
msg->AddRef("refs", &ref); msg->AddRef("refs", &ref);
BMenuItem *menuitem = menu->FindItem(path.Leaf()); BMenuItem *menuitem = menu->FindItem(path.Leaf());
if(!menuitem) if (!menuitem)
menu->AddItem(menuitem = new BMenuItem(path.Leaf(), msg), 0); menu->AddItem(menuitem = new BMenuItem(path.Leaf(), msg), 0);
// refresh item // refresh item
fEventList->SetPath(BPath(&ref).Path()); fEventList->SetPath(BPath(&ref).Path());
// check file menu // check file menu
if(menuitem) if (menuitem)
menuitem->SetMarked(true); menuitem->SetMarked(true);
} }
break; break;
@ -238,11 +238,11 @@ HWindow::MessageReceived(BMessage *message)
case M_PLAY_MESSAGE: case M_PLAY_MESSAGE:
{ {
int32 sel = fEventList->CurrentSelection(); int32 sel = fEventList->CurrentSelection();
if(sel >= 0) if (sel >= 0)
{ {
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
const char* path = item->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);
@ -255,9 +255,9 @@ HWindow::MessageReceived(BMessage *message)
} }
case M_STOP_MESSAGE: case M_STOP_MESSAGE:
{ {
if(!fPlayer) if (!fPlayer)
break; break;
if(fPlayer->IsPlaying()) if (fPlayer->IsPlaying())
{ {
fPlayer->StopPlaying(); fPlayer->StopPlaying();
delete fPlayer; delete fPlayer;
@ -271,15 +271,15 @@ 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();
if(message->FindString("path", &path) == B_OK) { if (message->FindString("path", &path) == B_OK) {
BPath path(path); BPath path(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)
item->SetMarked(true); item->SetMarked(true);
} else { } else {
BMenuItem *item = menu->FindItem(path.Leaf()); BMenuItem *item = menu->FindItem(path.Leaf());
if(item) if (item)
item->SetMarked(true); item->SetMarked(true);
} }
} }
@ -288,7 +288,7 @@ HWindow::MessageReceived(BMessage *message)
case M_ITEM_MESSAGE: case M_ITEM_MESSAGE:
{ {
entry_ref ref; entry_ref ref;
if(message->FindRef("refs", &ref) == B_OK) { if (message->FindRef("refs", &ref) == B_OK) {
fEventList->SetPath(BPath(&ref).Path()); fEventList->SetPath(BPath(&ref).Path());
} }
break; break;
@ -314,13 +314,13 @@ HWindow::SetupMenuField()
int32 count = fEventList->CountItems(); int32 count = fEventList->CountItems();
for(int32 i = 0; i < count; i++) { for(int32 i = 0; i < count; i++) {
HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem); HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem);
if(!item) if (!item)
continue; continue;
BPath path(item->Path()); BPath path(item->Path());
if(path.InitCheck() != B_OK) if (path.InitCheck() != B_OK)
continue; continue;
if(menu->FindItem(path.Leaf())) if (menu->FindItem(path.Leaf()))
continue; continue;
BMessage *msg = new BMessage(M_ITEM_MESSAGE); BMessage *msg = new BMessage(M_ITEM_MESSAGE);
@ -408,10 +408,10 @@ HWindow::Pulse()
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);
if(!menufield) if (!menufield)
return; return;
if(sel >=0) { if (sel >=0) {
menufield->SetEnabled(true); menufield->SetEnabled(true);
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
@ -424,8 +424,8 @@ HWindow::Pulse()
menufield->SetEnabled(false); menufield->SetEnabled(false);
button->SetEnabled(false); button->SetEnabled(false);
} }
if(fPlayer) { if (fPlayer) {
if(fPlayer->IsPlaying()) if (fPlayer->IsPlaying())
stop->SetEnabled(true); stop->SetEnabled(true);
else else
stop->SetEnabled(false); stop->SetEnabled(false);
@ -440,7 +440,7 @@ HWindow::Pulse()
void void
HWindow::DispatchMessage(BMessage *message, BHandler *handler) HWindow::DispatchMessage(BMessage *message, BHandler *handler)
{ {
if(message->what == B_PULSE) if (message->what == B_PULSE)
Pulse(); Pulse();
BWindow::DispatchMessage(message, handler); BWindow::DispatchMessage(message, handler);
} }

View File

@ -3,7 +3,7 @@ SubDir HAIKU_TOP src preferences sounds ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
SubDirC++Flags -fmultiple-symbol-spaces ; SubDirC++Flags -fmultiple-symbol-spaces ;
} }
Preference Sounds : Preference Sounds :

View File

@ -13,7 +13,7 @@ resource app_version {
internal = 0, internal = 0,
short_info = "VirtualMemory", short_info = "VirtualMemory",
long_info = "VirtualMemory ©2005-2007 Haiku" long_info = "VirtualMemory ©2005-2007 Haiku"
}; };
resource app_flags B_SINGLE_LAUNCH; resource app_flags B_SINGLE_LAUNCH;