* Tracker wrote icons with the wrong type at several places.

* Also replaced all B_COLOR_8_BIT with the B_CMAP8 constant.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16909 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-03-28 11:32:21 +00:00
parent 9913366fe7
commit cd94fddab2
8 changed files with 271 additions and 186 deletions
+7 -8
View File
@@ -2126,7 +2126,7 @@ FSGetDeskDir(BDirectory *deskDir, dev_t dev)
status_t result = volume.InitCheck();
if (result != B_OK)
return result;
BPath path;
result = find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume);
if (result != B_OK)
@@ -2147,14 +2147,14 @@ FSGetDeskDir(BDirectory *deskDir, dev_t dev)
LoadResource('ICON', kResDeskIcon, &size);
if (data)
deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
deskDir->WriteAttr(kAttrLargeIcon, 'ICON', 0, data, size);
data = GetTrackerResources()->
LoadResource('MICN', kResDeskIcon, &size);
if (data)
deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
deskDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, data, size);
return B_OK;
}
@@ -2631,10 +2631,9 @@ FSCreateTrashDirs()
roster.Rewind();
while (roster.GetNextVolume(&volume) == B_OK) {
if (volume.IsReadOnly() || !volume.IsPersistent())
continue;
BPath path;
find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume);
find_directory(B_TRASH_DIRECTORY, &path, true, &volume);
@@ -2645,13 +2644,13 @@ FSCreateTrashDirs()
const void* data = GetTrackerResources()->
LoadResource('ICON', kResTrashIcon, &size);
if (data) {
trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0,
trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0,
data, size);
}
data = GetTrackerResources()->
LoadResource('MICN', kResTrashIcon, &size);
if (data) {
trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0,
trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0,
data, size);
}
}
+5 -5
View File
@@ -1049,8 +1049,8 @@ TDraggableIconButton::AttachedToWindow()
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fIcon = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_COLOR_8_BIT);
fIcon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_CMAP8);
// calculate correct frame for icon and label
// sets icon rect and label rect for drawing
ResizeToPreferred();
@@ -1250,14 +1250,14 @@ TContentsMenu::AttachedToWindow()
fDownBtn->SetTarget(this, Window());
// cache the new group icon
fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT);
fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
fSmallGroupIcon->SetBits(kSmallNewGroupIcon, fSmallGroupIcon->BitsLength(),
0, B_COLOR_8_BIT);
0, B_CMAP8);
// cache the symlink icon
BMimeType symlink("application/x-vnd.Be-symlink");
if (symlink.InitCheck() == B_OK) {
fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT);
fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
if (symlink.GetIcon(fSymlinkIcon, B_MINI_ICON) != B_OK)
fSymlinkIcon = NULL;
} else
+34 -33
View File
@@ -34,29 +34,29 @@ All rights reserved.
// menu items with small icons.
#include "IconCache.h"
#include "IconMenuItem.h"
#include <Debug.h>
#include <Menu.h>
#include <NodeInfo.h>
#include "IconCache.h"
#include "IconMenuItem.h"
ModelMenuItem::ModelMenuItem(const Model *model, const char *title,
BMessage *message, char shortcut, uint32 modifiers,
bool drawText, bool extraPad)
: BMenuItem(title, message, shortcut, modifiers),
fModel(*model),
fHeightDelta(0),
fDrawText(drawText),
fExtraPad(extraPad)
BMessage *message, char shortcut, uint32 modifiers,
bool drawText, bool extraPad)
: BMenuItem(title, message, shortcut, modifiers),
fModel(*model),
fHeightDelta(0),
fDrawText(drawText),
fExtraPad(extraPad)
{
ThrowOnInitCheckError(&fModel);
// The 'fExtraPad' field is used to when this menu item is added to
// a menubar instead of a menu. Menus and MenuBars space out items
// differently (more space around items in a menu). This class wants
// to be able to space item the same, no matter where they are. The
// fExtraPad field allows for that.
// The 'fExtraPad' field is used to when this menu item is added to
// a menubar instead of a menu. Menus and MenuBars space out items
// differently (more space around items in a menu). This class wants
// to be able to space item the same, no matter where they are. The
// fExtraPad field allows for that.
if (model->IsRoot())
SetLabel(model->Name());
@@ -189,10 +189,11 @@ ModelMenuItem::Invoke(BMessage *message)
clone.AddInt64("when", system_time());
clone.AddPointer("source", this);
if ((modifiers() & B_OPTION_KEY) == 0)
if ((modifiers() & B_OPTION_KEY) == 0) {
// if option not held, remove refs to close to prevent closing
// parent window
clone.RemoveData("nodeRefsToClose");
}
return BInvoker::Invoke(&clone);
}
@@ -226,8 +227,8 @@ SpecialModelMenuItem::DrawContent()
IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon)
: PositionPassingMenuItem(label, message),
fDeviceIcon(icon)
: PositionPassingMenuItem(label, message),
fDeviceIcon(icon)
{
// IconMenuItem is used in synchronously invoked menus, make sure
// we invoke with a timeout
@@ -236,18 +237,18 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon)
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
const BNodeInfo *nodeInfo, icon_size which)
: PositionPassingMenuItem(label, message),
fDeviceIcon(NULL)
const BNodeInfo *nodeInfo, icon_size which)
: PositionPassingMenuItem(label, message),
fDeviceIcon(NULL)
{
if (nodeInfo) {
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT);
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8);
if (nodeInfo->GetTrackerIcon(fDeviceIcon, B_MINI_ICON)) {
delete fDeviceIcon;
fDeviceIcon = NULL;
}
}
// IconMenuItem is used in synchronously invoked menus, make sure
// we invoke with a timeout
SetTimeout(kSynchMenuInvokeTimeout);
@@ -255,18 +256,18 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
const char *iconType, icon_size which)
: PositionPassingMenuItem(label, message),
fDeviceIcon(NULL)
const char *iconType, icon_size which)
: PositionPassingMenuItem(label, message),
fDeviceIcon(NULL)
{
BMimeType mime(iconType);
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT);
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8);
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
delete fDeviceIcon;
fDeviceIcon = NULL;
}
// IconMenuItem is used in synchronously invoked menus, make sure
// we invoke with a timeout
SetTimeout(kSynchMenuInvokeTimeout);
@@ -274,18 +275,18 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message,
const char *iconType, icon_size which)
: PositionPassingMenuItem(submenu, message),
fDeviceIcon(NULL)
const char *iconType, icon_size which)
: PositionPassingMenuItem(submenu, message),
fDeviceIcon(NULL)
{
BMimeType mime(iconType);
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT);
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8);
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
delete fDeviceIcon;
fDeviceIcon = NULL;
}
// IconMenuItem is used in synchronously invoked menus, make sure
// we invoke with a timeout
SetTimeout(kSynchMenuInvokeTimeout);
+1 -1
View File
@@ -1327,7 +1327,7 @@ Model::TrackIconSource(icon_size size)
else
rect.Set(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1);
BBitmap bitmap(rect, B_COLOR_8_BIT);
BBitmap bitmap(rect, B_CMAP8);
BModelOpener opener(this);
+2 -2
View File
@@ -78,7 +78,7 @@ AddOnePartitionAsMenuItem(Partition *partition, void *castToParams)
AddOneAsMenuItemParams *params = (AddOneAsMenuItemParams *)castToParams;
BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1),
B_COLOR_8_BIT);
B_CMAP8);
get_device_icon(partition->GetDevice()->Name(), icon->Bits(), B_MINI_ICON);
@@ -160,7 +160,7 @@ MountMenu::AddDynamicItem(add_state)
while (volumeRoster.GetNextVolume(&volume) == B_OK) {
if (volume.IsShared()) {
needSeparator = true;
BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT);
BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
fs_info info;
if (fs_stat_dev(volume.Device(), &info) != B_OK) {
PRINT(("Cannot get mount menu item icon; bad device ID\n"));
+2 -2
View File
@@ -158,8 +158,8 @@ TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID,
// whole mime type is installed and all attributes are set; nulls can
// be passed for attributes that don't matter; returns true if anything
// had to be changed
BBitmap largeIcon(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
BBitmap miniIcon(BRect(0, 0, 15, 15), B_COLOR_8_BIT);
BBitmap largeIcon(BRect(0, 0, 31, 31), B_CMAP8);
BBitmap miniIcon(BRect(0, 0, 15, 15), B_CMAP8);
char tmp[B_MIME_TYPE_LENGTH];
BMimeType mime(type);
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -75,7 +75,7 @@ const int64 kTBSize = kGBSize * kKBSize;
const int32 kMiniIconSeparator = 3;
const color_space kDefaultIconDepth = B_COLOR_8_BIT;
const color_space kDefaultIconDepth = B_CMAP8;
// misc typedefs, constants and structs