style cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23502 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -39,7 +39,7 @@ HApp::AboutRequested()
|
|||||||
" Oliver Ruiz Dorantes\n"
|
" Oliver Ruiz Dorantes\n"
|
||||||
" Jérôme DUVAL.\n"
|
" Jérôme DUVAL.\n"
|
||||||
" Original work from Atsushi Takamatsu.\n"
|
" Original work from Atsushi Takamatsu.\n"
|
||||||
"Copyright " B_UTF8_COPYRIGHT "2003-2006 Haiku","OK"))->Go();
|
"Copyright " B_UTF8_COPYRIGHT "2003-2006 Haiku", "OK"))->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ HEventItem::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());
|
||||||
|
|||||||
@@ -39,17 +39,17 @@
|
|||||||
/***********************************************************
|
/***********************************************************
|
||||||
* Constructor
|
* Constructor
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
HWindow::HWindow(BRect rect ,const char* name)
|
HWindow::HWindow(BRect rect, const char* name)
|
||||||
:_inherited(rect,name,B_TITLED_WINDOW,0)
|
:_inherited(rect, name, B_TITLED_WINDOW, 0),
|
||||||
,fFilePanel(NULL)
|
fFilePanel(NULL),
|
||||||
,fPlayer(NULL)
|
fPlayer(NULL)
|
||||||
{
|
{
|
||||||
InitGUI();
|
InitGUI();
|
||||||
float min_width,min_height,max_width,max_height;
|
float min_width, min_height, max_width, max_height;
|
||||||
GetSizeLimits(&min_width,&max_width,&min_height,&max_height);
|
GetSizeLimits(&min_width, &max_width, &min_height, &max_height);
|
||||||
min_width = 300;
|
min_width = 300;
|
||||||
min_height = 200;
|
min_height = 200;
|
||||||
SetSizeLimits(min_width,max_width,min_height,max_height);
|
SetSizeLimits(min_width, max_width, min_height, max_height);
|
||||||
|
|
||||||
fFilePanel = new BFilePanel();
|
fFilePanel = new BFilePanel();
|
||||||
fFilePanel->SetTarget(this);
|
fFilePanel->SetTarget(this);
|
||||||
@@ -74,7 +74,7 @@ HWindow::InitGUI()
|
|||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
rect.bottom -= 106;
|
rect.bottom -= 106;
|
||||||
BView *listView = new BView(rect,"",B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
|
BView *listView = new BView(rect, "", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
|
||||||
listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(listView);
|
AddChild(listView);
|
||||||
|
|
||||||
@@ -107,11 +107,11 @@ HWindow::InitGUI()
|
|||||||
|
|
||||||
rect = Bounds();
|
rect = Bounds();
|
||||||
rect.top = rect.bottom - 105;
|
rect.top = rect.bottom - 105;
|
||||||
BView *view = new BView(rect,"", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
|
BView *view = new BView(rect, "", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED);
|
||||||
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(view);
|
AddChild(view);
|
||||||
rect = view->Bounds().InsetBySelf(12, 12);
|
rect = view->Bounds().InsetBySelf(12, 12);
|
||||||
BBox *box = new BBox(rect,"",B_FOLLOW_ALL);
|
BBox *box = new BBox(rect, "", B_FOLLOW_ALL);
|
||||||
view->AddChild(box);
|
view->AddChild(box);
|
||||||
rect = box->Bounds();
|
rect = box->Bounds();
|
||||||
rect.top += 10;
|
rect.top += 10;
|
||||||
@@ -123,8 +123,8 @@ HWindow::InitGUI()
|
|||||||
menu->SetLabelFromMarked(true);
|
menu->SetLabelFromMarked(true);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem("<none>",new BMessage(M_NONE_MESSAGE)));
|
menu->AddItem(new BMenuItem("<none>", new BMessage(M_NONE_MESSAGE)));
|
||||||
menu->AddItem(new BMenuItem("Other…",new BMessage(M_OTHER_MESSAGE)));
|
menu->AddItem(new BMenuItem("Other…", new BMessage(M_OTHER_MESSAGE)));
|
||||||
BMenuField *menuField = new BMenuField(rect
|
BMenuField *menuField = new BMenuField(rect
|
||||||
,"filemenu"
|
,"filemenu"
|
||||||
,"Sound File:"
|
,"Sound File:"
|
||||||
@@ -178,12 +178,12 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
case M_OTHER_MESSAGE:
|
case M_OTHER_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();
|
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>");
|
||||||
@@ -203,8 +203,8 @@ 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
|
||||||
BNode node(&ref);
|
BNode node(&ref);
|
||||||
@@ -216,17 +216,17 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
mtype.GetSupertype(&superType);
|
mtype.GetSupertype(&superType);
|
||||||
if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) {
|
if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) {
|
||||||
beep();
|
beep();
|
||||||
(new BAlert("","This is not a audio file.","OK",NULL,NULL,
|
(new BAlert("", "This is not a audio file.", "OK", NULL, NULL,
|
||||||
B_WIDTH_AS_USUAL,B_STOP_ALERT))->Go();
|
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// add file item
|
// add file item
|
||||||
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
BMessage *msg = new BMessage(M_ITEM_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
|
||||||
@@ -240,14 +240,14 @@ HWindow::MessageReceived(BMessage *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);
|
||||||
delete fPlayer;
|
delete fPlayer;
|
||||||
fPlayer = new BFileGameSound(&ref,false);
|
fPlayer = new BFileGameSound(&ref, false);
|
||||||
fPlayer->StartPlaying();
|
fPlayer->StartPlaying();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,10 +268,10 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
case M_EVENT_CHANGED:
|
case M_EVENT_CHANGED:
|
||||||
{
|
{
|
||||||
const char* path;
|
const char* path;
|
||||||
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>");
|
||||||
@@ -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;
|
||||||
@@ -309,7 +309,7 @@ HWindow::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
HWindow::SetupMenuField()
|
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->CountItems();
|
||||||
for(int32 i = 0; i < count; i++) {
|
for(int32 i = 0; i < count; i++) {
|
||||||
@@ -325,9 +325,9 @@ HWindow::SetupMenuField()
|
|||||||
|
|
||||||
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
::get_ref_for_path(path.Path(),&ref);
|
::get_ref_for_path(path.Path(), &ref);
|
||||||
msg->AddRef("refs",&ref);
|
msg->AddRef("refs", &ref);
|
||||||
menu->AddItem(new BMenuItem(path.Leaf(),msg),0);
|
menu->AddItem(new BMenuItem(path.Leaf(), msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BPath path("/boot/beos/etc/sounds");
|
BPath path("/boot/beos/etc/sounds");
|
||||||
@@ -335,63 +335,63 @@ HWindow::SetupMenuField()
|
|||||||
BDirectory dir( path.Path() );
|
BDirectory dir( path.Path() );
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath item_path;
|
BPath item_path;
|
||||||
while( err == B_OK ){
|
while (err == B_OK){
|
||||||
err = dir.GetNextEntry( (BEntry*)&entry, TRUE );
|
err = dir.GetNextEntry((BEntry *)&entry, true);
|
||||||
if( entry.InitCheck() != B_NO_ERROR ){
|
if (entry.InitCheck() != B_NO_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entry.GetPath(&item_path);
|
entry.GetPath(&item_path);
|
||||||
|
|
||||||
if( menu->FindItem(item_path.Leaf()) )
|
if (menu->FindItem(item_path.Leaf()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
::get_ref_for_path(item_path.Path(),&ref);
|
::get_ref_for_path(item_path.Path(), &ref);
|
||||||
msg->AddRef("refs",&ref);
|
msg->AddRef("refs", &ref);
|
||||||
menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0);
|
menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
path.SetTo("/boot/home/config/sounds");
|
path.SetTo("/boot/home/config/sounds");
|
||||||
dir.SetTo(path.Path());
|
dir.SetTo(path.Path());
|
||||||
err = B_OK;
|
err = B_OK;
|
||||||
while( err == B_OK ){
|
while (err == B_OK) {
|
||||||
err = dir.GetNextEntry( (BEntry*)&entry, TRUE );
|
err = dir.GetNextEntry((BEntry *)&entry, true);
|
||||||
if( entry.InitCheck() != B_NO_ERROR ){
|
if (entry.InitCheck() != B_NO_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entry.GetPath(&item_path);
|
entry.GetPath(&item_path);
|
||||||
|
|
||||||
if( menu->FindItem(item_path.Leaf()) )
|
if (menu->FindItem(item_path.Leaf()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
|
|
||||||
::get_ref_for_path(item_path.Path(),&ref);
|
::get_ref_for_path(item_path.Path(), &ref);
|
||||||
msg->AddRef("refs",&ref);
|
msg->AddRef("refs", &ref);
|
||||||
menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0);
|
menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
path.SetTo("/boot/home/media");
|
path.SetTo("/boot/home/media");
|
||||||
dir.SetTo(path.Path());
|
dir.SetTo(path.Path());
|
||||||
err = B_OK;
|
err = B_OK;
|
||||||
while( err == B_OK ){
|
while (err == B_OK) {
|
||||||
err = dir.GetNextEntry( (BEntry*)&entry, TRUE );
|
err = dir.GetNextEntry((BEntry *)&entry, true);
|
||||||
if( entry.InitCheck() != B_NO_ERROR ){
|
if (entry.InitCheck() != B_NO_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entry.GetPath(&item_path);
|
entry.GetPath(&item_path);
|
||||||
|
|
||||||
if( menu->FindItem(item_path.Leaf()) )
|
if (menu->FindItem(item_path.Leaf()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
|
|
||||||
::get_ref_for_path(item_path.Path(),&ref);
|
::get_ref_for_path(item_path.Path(), &ref);
|
||||||
msg->AddRef("refs",&ref);
|
msg->AddRef("refs", &ref);
|
||||||
menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0);
|
menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -404,9 +404,9 @@ void
|
|||||||
HWindow::Pulse()
|
HWindow::Pulse()
|
||||||
{
|
{
|
||||||
int32 sel = fEventList->CurrentSelection();
|
int32 sel = 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);
|
||||||
|
|
||||||
if(!menufield)
|
if(!menufield)
|
||||||
return;
|
return;
|
||||||
@@ -414,7 +414,7 @@ HWindow::Pulse()
|
|||||||
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);
|
||||||
const char* path = item->Path();
|
const char* path = item->Path();
|
||||||
if (path && strcmp(path, ""))
|
if (path && strcmp(path, ""))
|
||||||
button->SetEnabled(true);
|
button->SetEnabled(true);
|
||||||
@@ -438,11 +438,11 @@ HWindow::Pulse()
|
|||||||
* DispatchMessage
|
* DispatchMessage
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user