From c71ff07bd9540240ee059b3946ab995dbaf0e12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 13 Jan 2008 22:17:15 +0000 Subject: [PATCH] style cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23502 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/sounds/HApp.cpp | 2 +- src/preferences/sounds/HEventItem.cpp | 5 +- src/preferences/sounds/HEventList.cpp | 8 +- src/preferences/sounds/HWindow.cpp | 132 +++++++++++++------------- src/preferences/sounds/Sounds.rdef | 2 +- 5 files changed, 74 insertions(+), 75 deletions(-) diff --git a/src/preferences/sounds/HApp.cpp b/src/preferences/sounds/HApp.cpp index 0d32e9a923..4d5ef1a610 100644 --- a/src/preferences/sounds/HApp.cpp +++ b/src/preferences/sounds/HApp.cpp @@ -39,7 +39,7 @@ HApp::AboutRequested() " Oliver Ruiz Dorantes\n" " Jérôme DUVAL.\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(); } diff --git a/src/preferences/sounds/HEventItem.cpp b/src/preferences/sounds/HEventItem.cpp index 2d2a144ad7..db55a62a93 100644 --- a/src/preferences/sounds/HEventItem.cpp +++ b/src/preferences/sounds/HEventItem.cpp @@ -61,11 +61,11 @@ HEventItem::Remove(const char *type) /*********************************************************** * DrawItem ***********************************************************/ -void +void HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete) { rgb_color kBlack = { 0,0,0,0 }; - + if (IsSelected() || complete) { rgb_color color; if (IsSelected()) @@ -77,7 +77,6 @@ HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete) owner->SetLowColor(color); owner->FillRect(itemRect); owner->SetHighColor(kBlack); - } else { owner->SetLowColor(owner->ViewColor()); diff --git a/src/preferences/sounds/HEventList.cpp b/src/preferences/sounds/HEventList.cpp index 675aa39171..d8bbc4ec6e 100644 --- a/src/preferences/sounds/HEventList.cpp +++ b/src/preferences/sounds/HEventList.cpp @@ -97,8 +97,8 @@ HEventList::SelectionChanged() HEventItem *item = cast_as(ItemAt(sel),HEventItem); if(!item) return; - - entry_ref ref; + + entry_ref ref; BMediaFiles().GetRefFor(fType, item->Name(), &ref); BPath path(&ref); @@ -117,7 +117,7 @@ HEventList::SelectionChanged() msg.AddString("path",item->Path()); Window()->PostMessage(&msg); } -} +} /*********************************************************** * SetPath @@ -137,6 +137,6 @@ HEventList::SetPath(const char* path) BMediaFiles().SetRefFor(fType, item->Name(), ref); item->SetPath(path); - InvalidateItem(sel); + InvalidateItem(sel); } } diff --git a/src/preferences/sounds/HWindow.cpp b/src/preferences/sounds/HWindow.cpp index cdb6a63266..3619dac24d 100644 --- a/src/preferences/sounds/HWindow.cpp +++ b/src/preferences/sounds/HWindow.cpp @@ -39,18 +39,18 @@ /*********************************************************** * Constructor ***********************************************************/ -HWindow::HWindow(BRect rect ,const char* name) - :_inherited(rect,name,B_TITLED_WINDOW,0) - ,fFilePanel(NULL) - ,fPlayer(NULL) +HWindow::HWindow(BRect rect, const char* name) + :_inherited(rect, name, B_TITLED_WINDOW, 0), + fFilePanel(NULL), + fPlayer(NULL) { InitGUI(); - float min_width,min_height,max_width,max_height; - GetSizeLimits(&min_width,&max_width,&min_height,&max_height); + float min_width, min_height, max_width, max_height; + GetSizeLimits(&min_width, &max_width, &min_height, &max_height); min_width = 300; 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->SetTarget(this); @@ -74,7 +74,7 @@ HWindow::InitGUI() { BRect rect = Bounds(); 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)); AddChild(listView); @@ -89,7 +89,7 @@ HWindow::InitGUI() stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); listView->AddChild(stringView); - + rect.left += 13; rect.right -= B_V_SCROLL_BAR_WIDTH + 13; rect.top += 28; @@ -107,11 +107,11 @@ HWindow::InitGUI() rect = Bounds(); 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)); AddChild(view); 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); rect = box->Bounds(); rect.top += 10; @@ -123,8 +123,8 @@ HWindow::InitGUI() menu->SetLabelFromMarked(true); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("",new BMessage(M_NONE_MESSAGE))); - menu->AddItem(new BMenuItem("Other…",new BMessage(M_OTHER_MESSAGE))); + menu->AddItem(new BMenuItem("", new BMessage(M_NONE_MESSAGE))); + menu->AddItem(new BMenuItem("Other…", new BMessage(M_OTHER_MESSAGE))); BMenuField *menuField = new BMenuField(rect ,"filemenu" ,"Sound File:" @@ -178,18 +178,18 @@ HWindow::MessageReceived(BMessage *message) switch(message->what) { case M_OTHER_MESSAGE: { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); int32 sel = fEventList->CurrentSelection(); if(sel >= 0) { - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); BPath path(item->Path()); if(path.InitCheck() != B_OK) { BMenuItem *item = menu->FindItem(""); if(item) item->SetMarked(true); - } else{ + } else{ BMenuItem *item = menu->FindItem(path.Leaf()); if(item) item->SetMarked(true); @@ -203,8 +203,8 @@ HWindow::MessageReceived(BMessage *message) { entry_ref ref; int32 sel = fEventList->CurrentSelection(); - if(message->FindRef("refs",&ref) == B_OK && sel >= 0) { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + if(message->FindRef("refs", &ref) == B_OK && sel >= 0) { + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); // check audio file BNode node(&ref); @@ -216,20 +216,20 @@ HWindow::MessageReceived(BMessage *message) mtype.GetSupertype(&superType); if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) { beep(); - (new BAlert("","This is not a audio file.","OK",NULL,NULL, - B_WIDTH_AS_USUAL,B_STOP_ALERT))->Go(); + (new BAlert("", "This is not a audio file.", "OK", NULL, NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); break; } // add file item BMessage *msg = new BMessage(M_ITEM_MESSAGE); BPath path(&ref); - msg->AddRef("refs",&ref); + msg->AddRef("refs", &ref); BMenuItem *menuitem = menu->FindItem(path.Leaf()); if(!menuitem) - menu->AddItem(menuitem = new BMenuItem(path.Leaf(),msg),0); + menu->AddItem(menuitem = new BMenuItem(path.Leaf(), msg), 0); // refresh item fEventList->SetPath(BPath(&ref).Path()); - // check file menu + // check file menu if(menuitem) menuitem->SetMarked(true); } @@ -240,14 +240,14 @@ HWindow::MessageReceived(BMessage *message) int32 sel = fEventList->CurrentSelection(); if(sel >= 0) { - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); const char* path = item->Path(); if(path) { entry_ref ref; - ::get_ref_for_path(path,&ref); + ::get_ref_for_path(path, &ref); delete fPlayer; - fPlayer = new BFileGameSound(&ref,false); + fPlayer = new BFileGameSound(&ref, false); fPlayer->StartPlaying(); } } @@ -268,16 +268,16 @@ HWindow::MessageReceived(BMessage *message) case M_EVENT_CHANGED: { const char* path; - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); - if(message->FindString("path",&path) == B_OK) { + if(message->FindString("path", &path) == B_OK) { BPath path(path); if(path.InitCheck() != B_OK) { BMenuItem *item = menu->FindItem(""); if(item) item->SetMarked(true); - } else { + } else { BMenuItem *item = menu->FindItem(path.Leaf()); if(item) item->SetMarked(true); @@ -288,7 +288,7 @@ HWindow::MessageReceived(BMessage *message) case M_ITEM_MESSAGE: { entry_ref ref; - if(message->FindRef("refs",&ref) == B_OK) { + if(message->FindRef("refs", &ref) == B_OK) { fEventList->SetPath(BPath(&ref).Path()); } break; @@ -309,14 +309,14 @@ HWindow::MessageReceived(BMessage *message) void HWindow::SetupMenuField() { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); int32 count = fEventList->CountItems(); for(int32 i = 0; i < count; i++) { HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem); if(!item) continue; - + BPath path(item->Path()); if(path.InitCheck() != B_OK) continue; @@ -325,9 +325,9 @@ HWindow::SetupMenuField() BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(path.Leaf(),msg),0); + ::get_ref_for_path(path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(path.Leaf(), msg), 0); } BPath path("/boot/beos/etc/sounds"); @@ -335,63 +335,63 @@ HWindow::SetupMenuField() BDirectory dir( path.Path() ); BEntry entry; BPath item_path; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK){ + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } path.SetTo("/boot/home/config/sounds"); dir.SetTo(path.Path()); err = B_OK; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK) { + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } path.SetTo("/boot/home/media"); dir.SetTo(path.Path()); err = B_OK; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK) { + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } } @@ -404,9 +404,9 @@ void HWindow::Pulse() { int32 sel = fEventList->CurrentSelection(); - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); - BButton *button = cast_as(FindView("play"),BButton); - BButton *stop = cast_as(FindView("stop"),BButton); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); + BButton *button = cast_as(FindView("play"), BButton); + BButton *stop = cast_as(FindView("stop"), BButton); if(!menufield) return; @@ -414,7 +414,7 @@ HWindow::Pulse() if(sel >=0) { menufield->SetEnabled(true); - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); const char* path = item->Path(); if (path && strcmp(path, "")) button->SetEnabled(true); @@ -438,11 +438,11 @@ HWindow::Pulse() * DispatchMessage ***********************************************************/ void -HWindow::DispatchMessage(BMessage *message,BHandler *handler) +HWindow::DispatchMessage(BMessage *message, BHandler *handler) { if(message->what == B_PULSE) Pulse(); - BWindow::DispatchMessage(message,handler); + BWindow::DispatchMessage(message, handler); } /*********************************************************** diff --git a/src/preferences/sounds/Sounds.rdef b/src/preferences/sounds/Sounds.rdef index 09efeff7c2..665b31a20e 100644 --- a/src/preferences/sounds/Sounds.rdef +++ b/src/preferences/sounds/Sounds.rdef @@ -15,7 +15,7 @@ resource app_version { internal = 0, short_info = "Sounds", - long_info = "Sounds ©2003-2007 Haiku" + long_info = "Sounds ©2003-2007 Haiku" }; resource file_types message;