diff --git a/src/prefs/media/Media.cpp b/src/prefs/media/Media.cpp index 8396ec6623..65b273cab2 100644 --- a/src/prefs/media/Media.cpp +++ b/src/prefs/media/Media.cpp @@ -28,13 +28,13 @@ Media::Media() BRect rect(32,64,637,442); 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); BFile file(path.Path(),B_READ_ONLY); - if(file.InitCheck()==B_OK) { + if (file.InitCheck()==B_OK) { char buffer[255]; ssize_t size = 0; - while((size = file.Read(buffer, 255))>0) { + while ((size = file.Read(buffer, 255)) > 0) { int32 i=0; while(buffer[i]=='#') { while(i0){ - if(c-a>=int(rect.Width())) { + if (sscanf(&buffer[i], " rect = %li,%li,%li,%li", &a, &b, &c, &d) > 0) { + if (c-a >= rect.IntegerWidth()) { rect.left = a; rect.right = c; } - if(d-b>=int(rect.Height())) { + if (d-b >= rect.IntegerHeight()) { rect.top = b; rect.bottom = d; } diff --git a/src/prefs/media/MediaListItem.cpp b/src/prefs/media/MediaListItem.cpp index 67cb0b92c0..6516b2c454 100644 --- a/src/prefs/media/MediaListItem.cpp +++ b/src/prefs/media/MediaListItem.cpp @@ -24,8 +24,8 @@ // MediaListItem - Constructor MediaListItem::MediaListItem(dormant_node_info *info, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0) : BListItem(level), - mIsVideo(isVideo), mIsAudioMixer(false), + mIsVideo(isVideo), mIsDefaultInput(false), mIsDefaultOutput(false) { @@ -36,11 +36,11 @@ MediaListItem::MediaListItem(dormant_node_info *info, uint32 level, bool isVideo SetHeight(16 + kITEM_MARGIN); } -MediaListItem::MediaListItem(const char* label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0) +MediaListItem::MediaListItem(const char *label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0) : BListItem(level), - mIsVideo(isVideo), mLabel(label), mIsAudioMixer(false), + mIsVideo(isVideo), mIsDefaultInput(false), mIsDefaultOutput(false) { @@ -62,15 +62,12 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete) { rgb_color kHighlight = { 140,140,140,0 }; rgb_color kBlack = { 0,0,0,0 }; - rgb_color kWhite = { 255,255,255,0 }; - + BRect r(frame); - - if (IsSelected() || complete) - { + + if (IsSelected() || complete) { rgb_color color; - if (IsSelected()) - { + if (IsSelected()) { color = kHighlight; } else { color = owner->ViewColor(); @@ -79,7 +76,6 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete) owner->SetLowColor(color); owner->FillRect(r); owner->SetHighColor(kBlack); - } else { owner->SetLowColor(owner->ViewColor()); } diff --git a/src/prefs/media/MediaListItem.h b/src/prefs/media/MediaListItem.h index 6ae6292589..a938ca6cdd 100644 --- a/src/prefs/media/MediaListItem.h +++ b/src/prefs/media/MediaListItem.h @@ -12,32 +12,34 @@ // Created : June 25, 2003 // // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - - #ifndef __MEDIALISTITEM_H__ #define __MEDIALISTITEM_H__ + #include #include -class MediaListItem : public BListItem -{ + +class MediaListItem : public BListItem { public: MediaListItem(dormant_node_info *info, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0); MediaListItem(const char* label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0); ~MediaListItem(); + virtual void Update(BView *owner, const BFont *finfo); virtual void DrawItem(BView *owner, BRect frame, bool complete = false); + void SetDefault(bool isDefaultInput, bool isInput); void SetAudioMixer(bool isAudioMixer); bool IsDefault(bool isInput) { return isInput ? mIsDefaultInput : mIsDefaultOutput; } bool IsAudioMixer() { return mIsAudioMixer; } bool IsVideo() { return mIsVideo; } - const char* GetLabel() { return mLabel; } - + const char *GetLabel() { return mLabel; } + dormant_node_info *mInfo; - + static int Compare(const void *firstArg, const void *secondArg); + private: const char *mLabel; bool mIsAudioMixer; @@ -48,5 +50,4 @@ class MediaListItem : public BListItem BList *mIcons; }; - -#endif +#endif /* __MEDIALISTITEM_H__ */ diff --git a/src/prefs/media/MediaViews.cpp b/src/prefs/media/MediaViews.cpp index cefae21a1c..64b6af0c0e 100644 --- a/src/prefs/media/MediaViews.cpp +++ b/src/prefs/media/MediaViews.cpp @@ -161,14 +161,14 @@ SettingsView::AddNodes(BList &list, bool isInput) { BMenu *menu = isInput ? mMenu1 : mMenu2; void *item; - while(item = menu->RemoveItem((int32)0)) + while ((item = menu->RemoveItem((int32)0)) != NULL) delete item; - + BMessage message(ML_DEFAULT_CHANGE); message.AddBool("isVideo", mIsVideo); message.AddBool("isInput", isInput); - - for(int32 i=0; i(list.ItemAt(i)); menu->AddItem(new SettingsItem(info, new BMessage(message))); } @@ -179,7 +179,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID) { BMenu *menu = isInput ? mMenu1 : mMenu2; - for(int32 i=0; iCountItems(); i++) { + for (int32 i = 0; i < menu->CountItems(); i++) { SettingsItem *item = static_cast(menu->ItemAt(i)); if(item->mInfo && item->mInfo->addon == info.addon && item->mInfo->flavor_id == info.flavor_id) { item->SetMarked(true); @@ -187,26 +187,26 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID) } } - if(!mIsVideo&&!isInput&&outputID>-1) { + if (!mIsVideo&&!isInput&&outputID>-1) { BMenuItem *item; - while(item = mMenu3->RemoveItem((int32)0)) + while ((item = mMenu3->RemoveItem((int32)0)) != NULL) delete item; BMediaRoster *roster = BMediaRoster::Roster(); media_node node; media_node_id node_id; status_t err; - if(roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK) + if (roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK) err = roster->InstantiateDormantNode(info, &node, B_FLAVOR_IS_GLOBAL); else err = roster->GetNodeFor(node_id, &node); - if(err == B_OK) { + if (err == B_OK) { media_input inputs[16]; int32 inputCount = 16; - if(roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) { + if (roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) { BMessage message(ML_DEFAULTOUTPUT_CHANGE); - Settings2Item *listItem; - for(int32 i=0; iAddItem(item = new Settings2Item(&info, input, new BMessage(message))); @@ -239,4 +239,4 @@ Settings2Item::~Settings2Item() { delete mInput; } - \ No newline at end of file + diff --git a/src/prefs/media/MediaWindow.cpp b/src/prefs/media/MediaWindow.cpp index 6257ac158e..600d997e0b 100644 --- a/src/prefs/media/MediaWindow.cpp +++ b/src/prefs/media/MediaWindow.cpp @@ -641,7 +641,7 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie) MediaAlert *alert = static_cast(cookie); PRINT(("stage : %i\n", stage)); char *string = "Unknown stage"; - switch(stage) { + switch (stage) { case 10: string = "Stopping Media Server..."; break; @@ -660,7 +660,8 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie) } BAutolock locker(alert); - if(locker.IsLocked()) + if (locker.IsLocked()) alert->TextView()->SetText(string); return true; -} \ No newline at end of file +} +