* Use the new get_device_icon() call under Haiku. This fixes bug #3325.

* Whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28972 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-01-20 20:38:44 +00:00
parent 530ce9aaab
commit c6790819de
+30 -34
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2008, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2004-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -158,7 +158,7 @@ class HeaderView : public BView, public BInvoker {
class TypeMenuItem : public BMenuItem { class TypeMenuItem : public BMenuItem {
public: public:
TypeMenuItem(const char *name, const char *type, BMessage *message); TypeMenuItem(const char *name, const char *type, BMessage *message);
virtual void GetContentSize(float *_width, float *_height); virtual void GetContentSize(float *_width, float *_height);
virtual void DrawContent(); virtual void DrawContent();
@@ -235,7 +235,7 @@ IconView::~IconView()
} }
void void
IconView::AttachedToWindow() IconView::AttachedToWindow()
{ {
if (Parent() != NULL) if (Parent() != NULL)
@@ -245,7 +245,7 @@ IconView::AttachedToWindow()
} }
void void
IconView::Draw(BRect updateRect) IconView::Draw(BRect updateRect)
{ {
if (fBitmap == NULL) if (fBitmap == NULL)
@@ -257,7 +257,7 @@ IconView::Draw(BRect updateRect)
} }
void void
IconView::UpdateIcon() IconView::UpdateIcon()
{ {
if (fBitmap == NULL) if (fBitmap == NULL)
@@ -271,16 +271,12 @@ IconView::UpdateIcon()
status_t status = B_ERROR; status_t status = B_ERROR;
if (fIsDevice) { if (fIsDevice) {
BBitmap* icon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
// TODO: as long as we'll use get_device_icon() for this
BPath path(&fRef); BPath path(&fRef);
status = get_device_icon(path.Path(), icon->Bits(), B_LARGE_ICON); #ifdef __HAIKU__
if (status == B_OK) { status = get_device_icon(path.Path(), fBitmap, B_LARGE_ICON);
delete fBitmap; #else
fBitmap = icon; status = get_device_icon(path.Path(), fBitmap->Bits(), B_LARGE_ICON);
} else #endif
delete icon;
} else } else
status = BNodeInfo::GetTrackerIcon(&fRef, fBitmap); status = BNodeInfo::GetTrackerIcon(&fRef, fBitmap);
@@ -325,7 +321,7 @@ PositionSlider::~PositionSlider()
#ifdef DRAW_SLIDER_BAR #ifdef DRAW_SLIDER_BAR
void void
PositionSlider::DrawBar() PositionSlider::DrawBar()
{ {
BView *view = OffscreenView(); BView *view = OffscreenView();
@@ -442,7 +438,7 @@ PositionSlider::SetSize(off_t size)
} }
void void
PositionSlider::SetBlockSize(uint32 blockSize) PositionSlider::SetBlockSize(uint32 blockSize)
{ {
if (blockSize == fBlockSize) if (blockSize == fBlockSize)
@@ -623,7 +619,7 @@ HeaderView::AttachedToWindow()
fStopButton->SetTarget(Parent()); fStopButton->SetTarget(Parent());
fPositionControl->SetTarget(this); fPositionControl->SetTarget(this);
fPositionSlider->SetTarget(this); fPositionSlider->SetTarget(this);
BMessage *message; BMessage *message;
Window()->AddShortcut(B_HOME, B_COMMAND_KEY, Window()->AddShortcut(B_HOME, B_COMMAND_KEY,
message = new BMessage(kMsgPositionUpdate), this); message = new BMessage(kMsgPositionUpdate), this);
@@ -667,7 +663,7 @@ HeaderView::Draw(BRect updateRect)
} }
void void
HeaderView::GetPreferredSize(float *_width, float *_height) HeaderView::GetPreferredSize(float *_width, float *_height)
{ {
if (_width) if (_width)
@@ -677,14 +673,14 @@ HeaderView::GetPreferredSize(float *_width, float *_height)
} }
void void
HeaderView::UpdateIcon() HeaderView::UpdateIcon()
{ {
fIconView->UpdateIcon(); fIconView->UpdateIcon();
} }
void void
HeaderView::FormatValue(char *buffer, size_t bufferSize, off_t value) HeaderView::FormatValue(char *buffer, size_t bufferSize, off_t value)
{ {
snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%Lx" : "%Ld", value); snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%Lx" : "%Ld", value);
@@ -705,7 +701,7 @@ HeaderView::UpdatePositionViews(bool all)
} }
void void
HeaderView::UpdateOffsetViews(bool all) HeaderView::UpdateOffsetViews(bool all)
{ {
char buffer[64]; char buffer[64];
@@ -719,7 +715,7 @@ HeaderView::UpdateOffsetViews(bool all)
} }
void void
HeaderView::UpdateFileSizeView() HeaderView::UpdateFileSizeView()
{ {
char buffer[64]; char buffer[64];
@@ -730,7 +726,7 @@ HeaderView::UpdateFileSizeView()
} }
void void
HeaderView::SetBase(base_type type) HeaderView::SetBase(base_type type)
{ {
if (fBase == type) if (fBase == type)
@@ -744,7 +740,7 @@ HeaderView::SetBase(base_type type)
} }
void void
HeaderView::SetTo(off_t position, uint32 blockSize) HeaderView::SetTo(off_t position, uint32 blockSize)
{ {
fPosition = position; fPosition = position;
@@ -925,7 +921,7 @@ TypeMenuItem::TypeMenuItem(const char *name, const char *type,
} }
void void
TypeMenuItem::GetContentSize(float *_width, float *_height) TypeMenuItem::GetContentSize(float *_width, float *_height)
{ {
BMenuItem::GetContentSize(_width, _height); BMenuItem::GetContentSize(_width, _height);
@@ -935,7 +931,7 @@ TypeMenuItem::GetContentSize(float *_width, float *_height)
} }
void void
TypeMenuItem::DrawContent() TypeMenuItem::DrawContent()
{ {
// draw the label // draw the label
@@ -1132,7 +1128,7 @@ TypeView::~TypeView()
} }
void void
TypeView::FrameResized(float width, float height) TypeView::FrameResized(float width, float height)
{ {
BRect rect = Bounds(); BRect rect = Bounds();
@@ -1193,7 +1189,7 @@ ProbeView::~ProbeView()
} }
void void
ProbeView::UpdateSizeLimits() ProbeView::UpdateSizeLimits()
{ {
if (Window() == NULL) if (Window() == NULL)
@@ -1224,7 +1220,7 @@ ProbeView::UpdateSizeLimits()
} }
void void
ProbeView::DetachedFromWindow() ProbeView::DetachedFromWindow()
{ {
fEditorLooper->QuitFind(); fEditorLooper->QuitFind();
@@ -1294,7 +1290,7 @@ ProbeView::_UpdateAttributesMenu(BMenu *menu)
} }
void void
ProbeView::AddSaveMenuItems(BMenu* menu, int32 index) ProbeView::AddSaveMenuItems(BMenu* menu, int32 index)
{ {
menu->AddItem(fSaveMenuItem = new BMenuItem("Save", menu->AddItem(fSaveMenuItem = new BMenuItem("Save",
@@ -1305,7 +1301,7 @@ ProbeView::AddSaveMenuItems(BMenu* menu, int32 index)
} }
void void
ProbeView::AddPrintMenuItems(BMenu* menu, int32 index) ProbeView::AddPrintMenuItems(BMenu* menu, int32 index)
{ {
BMenuItem *item; BMenuItem *item;
@@ -1318,7 +1314,7 @@ ProbeView::AddPrintMenuItems(BMenu* menu, int32 index)
} }
void void
ProbeView::AddViewAsMenuItems() ProbeView::AddViewAsMenuItems()
{ {
#if 0 #if 0
@@ -1358,7 +1354,7 @@ ProbeView::AddViewAsMenuItems()
} }
void void
ProbeView::AttachedToWindow() ProbeView::AttachedToWindow()
{ {
fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor, fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor,
@@ -1656,7 +1652,7 @@ ProbeView::_UpdateBookmarkMenuItems()
} }
void void
ProbeView::_AddBookmark(off_t position) ProbeView::_AddBookmark(off_t position)
{ {
int32 count = fBookmarkMenu->CountItems(); int32 count = fBookmarkMenu->CountItems();