* 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:
@@ -2147,13 +2147,13 @@ FSGetDeskDir(BDirectory *deskDir, dev_t dev)
|
|||||||
LoadResource('ICON', kResDeskIcon, &size);
|
LoadResource('ICON', kResDeskIcon, &size);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
|
deskDir->WriteAttr(kAttrLargeIcon, 'ICON', 0, data, size);
|
||||||
|
|
||||||
data = GetTrackerResources()->
|
data = GetTrackerResources()->
|
||||||
LoadResource('MICN', kResDeskIcon, &size);
|
LoadResource('MICN', kResDeskIcon, &size);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
|
deskDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, data, size);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -2631,7 +2631,6 @@ FSCreateTrashDirs()
|
|||||||
|
|
||||||
roster.Rewind();
|
roster.Rewind();
|
||||||
while (roster.GetNextVolume(&volume) == B_OK) {
|
while (roster.GetNextVolume(&volume) == B_OK) {
|
||||||
|
|
||||||
if (volume.IsReadOnly() || !volume.IsPersistent())
|
if (volume.IsReadOnly() || !volume.IsPersistent())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2645,13 +2644,13 @@ FSCreateTrashDirs()
|
|||||||
const void* data = GetTrackerResources()->
|
const void* data = GetTrackerResources()->
|
||||||
LoadResource('ICON', kResTrashIcon, &size);
|
LoadResource('ICON', kResTrashIcon, &size);
|
||||||
if (data) {
|
if (data) {
|
||||||
trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0,
|
trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0,
|
||||||
data, size);
|
data, size);
|
||||||
}
|
}
|
||||||
data = GetTrackerResources()->
|
data = GetTrackerResources()->
|
||||||
LoadResource('MICN', kResTrashIcon, &size);
|
LoadResource('MICN', kResTrashIcon, &size);
|
||||||
if (data) {
|
if (data) {
|
||||||
trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0,
|
trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0,
|
||||||
data, size);
|
data, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1049,8 +1049,8 @@ TDraggableIconButton::AttachedToWindow()
|
|||||||
else
|
else
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
fIcon = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
|
fIcon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_COLOR_8_BIT);
|
fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_CMAP8);
|
||||||
// calculate correct frame for icon and label
|
// calculate correct frame for icon and label
|
||||||
// sets icon rect and label rect for drawing
|
// sets icon rect and label rect for drawing
|
||||||
ResizeToPreferred();
|
ResizeToPreferred();
|
||||||
@@ -1250,14 +1250,14 @@ TContentsMenu::AttachedToWindow()
|
|||||||
fDownBtn->SetTarget(this, Window());
|
fDownBtn->SetTarget(this, Window());
|
||||||
|
|
||||||
// cache the new group icon
|
// 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(),
|
fSmallGroupIcon->SetBits(kSmallNewGroupIcon, fSmallGroupIcon->BitsLength(),
|
||||||
0, B_COLOR_8_BIT);
|
0, B_CMAP8);
|
||||||
|
|
||||||
// cache the symlink icon
|
// cache the symlink icon
|
||||||
BMimeType symlink("application/x-vnd.Be-symlink");
|
BMimeType symlink("application/x-vnd.Be-symlink");
|
||||||
if (symlink.InitCheck() == B_OK) {
|
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)
|
if (symlink.GetIcon(fSymlinkIcon, B_MINI_ICON) != B_OK)
|
||||||
fSymlinkIcon = NULL;
|
fSymlinkIcon = NULL;
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -34,29 +34,29 @@ All rights reserved.
|
|||||||
|
|
||||||
// menu items with small icons.
|
// menu items with small icons.
|
||||||
|
|
||||||
|
#include "IconCache.h"
|
||||||
|
#include "IconMenuItem.h"
|
||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
|
|
||||||
#include "IconCache.h"
|
|
||||||
#include "IconMenuItem.h"
|
|
||||||
|
|
||||||
|
|
||||||
ModelMenuItem::ModelMenuItem(const Model *model, const char *title,
|
ModelMenuItem::ModelMenuItem(const Model *model, const char *title,
|
||||||
BMessage *message, char shortcut, uint32 modifiers,
|
BMessage *message, char shortcut, uint32 modifiers,
|
||||||
bool drawText, bool extraPad)
|
bool drawText, bool extraPad)
|
||||||
: BMenuItem(title, message, shortcut, modifiers),
|
: BMenuItem(title, message, shortcut, modifiers),
|
||||||
fModel(*model),
|
fModel(*model),
|
||||||
fHeightDelta(0),
|
fHeightDelta(0),
|
||||||
fDrawText(drawText),
|
fDrawText(drawText),
|
||||||
fExtraPad(extraPad)
|
fExtraPad(extraPad)
|
||||||
{
|
{
|
||||||
ThrowOnInitCheckError(&fModel);
|
ThrowOnInitCheckError(&fModel);
|
||||||
// The 'fExtraPad' field is used to when this menu item is added to
|
// 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
|
// a menubar instead of a menu. Menus and MenuBars space out items
|
||||||
// differently (more space around items in a menu). This class wants
|
// 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
|
// to be able to space item the same, no matter where they are. The
|
||||||
// fExtraPad field allows for that.
|
// fExtraPad field allows for that.
|
||||||
|
|
||||||
if (model->IsRoot())
|
if (model->IsRoot())
|
||||||
SetLabel(model->Name());
|
SetLabel(model->Name());
|
||||||
@@ -189,10 +189,11 @@ ModelMenuItem::Invoke(BMessage *message)
|
|||||||
clone.AddInt64("when", system_time());
|
clone.AddInt64("when", system_time());
|
||||||
clone.AddPointer("source", this);
|
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
|
// if option not held, remove refs to close to prevent closing
|
||||||
// parent window
|
// parent window
|
||||||
clone.RemoveData("nodeRefsToClose");
|
clone.RemoveData("nodeRefsToClose");
|
||||||
|
}
|
||||||
|
|
||||||
return BInvoker::Invoke(&clone);
|
return BInvoker::Invoke(&clone);
|
||||||
}
|
}
|
||||||
@@ -226,8 +227,8 @@ SpecialModelMenuItem::DrawContent()
|
|||||||
|
|
||||||
|
|
||||||
IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon)
|
IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon)
|
||||||
: PositionPassingMenuItem(label, message),
|
: PositionPassingMenuItem(label, message),
|
||||||
fDeviceIcon(icon)
|
fDeviceIcon(icon)
|
||||||
{
|
{
|
||||||
// IconMenuItem is used in synchronously invoked menus, make sure
|
// IconMenuItem is used in synchronously invoked menus, make sure
|
||||||
// we invoke with a timeout
|
// we invoke with a timeout
|
||||||
@@ -236,12 +237,12 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon)
|
|||||||
|
|
||||||
|
|
||||||
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
||||||
const BNodeInfo *nodeInfo, icon_size which)
|
const BNodeInfo *nodeInfo, icon_size which)
|
||||||
: PositionPassingMenuItem(label, message),
|
: PositionPassingMenuItem(label, message),
|
||||||
fDeviceIcon(NULL)
|
fDeviceIcon(NULL)
|
||||||
{
|
{
|
||||||
if (nodeInfo) {
|
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)) {
|
if (nodeInfo->GetTrackerIcon(fDeviceIcon, B_MINI_ICON)) {
|
||||||
delete fDeviceIcon;
|
delete fDeviceIcon;
|
||||||
fDeviceIcon = NULL;
|
fDeviceIcon = NULL;
|
||||||
@@ -255,12 +256,12 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
|||||||
|
|
||||||
|
|
||||||
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
||||||
const char *iconType, icon_size which)
|
const char *iconType, icon_size which)
|
||||||
: PositionPassingMenuItem(label, message),
|
: PositionPassingMenuItem(label, message),
|
||||||
fDeviceIcon(NULL)
|
fDeviceIcon(NULL)
|
||||||
{
|
{
|
||||||
BMimeType mime(iconType);
|
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) {
|
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
delete fDeviceIcon;
|
delete fDeviceIcon;
|
||||||
@@ -274,12 +275,12 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
|||||||
|
|
||||||
|
|
||||||
IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message,
|
IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message,
|
||||||
const char *iconType, icon_size which)
|
const char *iconType, icon_size which)
|
||||||
: PositionPassingMenuItem(submenu, message),
|
: PositionPassingMenuItem(submenu, message),
|
||||||
fDeviceIcon(NULL)
|
fDeviceIcon(NULL)
|
||||||
{
|
{
|
||||||
BMimeType mime(iconType);
|
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) {
|
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
delete fDeviceIcon;
|
delete fDeviceIcon;
|
||||||
|
|||||||
@@ -1327,7 +1327,7 @@ Model::TrackIconSource(icon_size size)
|
|||||||
else
|
else
|
||||||
rect.Set(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1);
|
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);
|
BModelOpener opener(this);
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ AddOnePartitionAsMenuItem(Partition *partition, void *castToParams)
|
|||||||
|
|
||||||
AddOneAsMenuItemParams *params = (AddOneAsMenuItemParams *)castToParams;
|
AddOneAsMenuItemParams *params = (AddOneAsMenuItemParams *)castToParams;
|
||||||
BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1),
|
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);
|
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) {
|
while (volumeRoster.GetNextVolume(&volume) == B_OK) {
|
||||||
if (volume.IsShared()) {
|
if (volume.IsShared()) {
|
||||||
needSeparator = true;
|
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;
|
fs_info info;
|
||||||
if (fs_stat_dev(volume.Device(), &info) != B_OK) {
|
if (fs_stat_dev(volume.Device(), &info) != B_OK) {
|
||||||
PRINT(("Cannot get mount menu item icon; bad device ID\n"));
|
PRINT(("Cannot get mount menu item icon; bad device ID\n"));
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID,
|
|||||||
// whole mime type is installed and all attributes are set; nulls can
|
// whole mime type is installed and all attributes are set; nulls can
|
||||||
// be passed for attributes that don't matter; returns true if anything
|
// be passed for attributes that don't matter; returns true if anything
|
||||||
// had to be changed
|
// had to be changed
|
||||||
BBitmap largeIcon(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
|
BBitmap largeIcon(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
BBitmap miniIcon(BRect(0, 0, 15, 15), B_COLOR_8_BIT);
|
BBitmap miniIcon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
char tmp[B_MIME_TYPE_LENGTH];
|
char tmp[B_MIME_TYPE_LENGTH];
|
||||||
|
|
||||||
BMimeType mime(type);
|
BMimeType mime(type);
|
||||||
|
|||||||
+164
-79
@@ -74,11 +74,16 @@ extern _IMPEXP_BE const uint32 MINI_ICON_TYPE;
|
|||||||
|
|
||||||
FILE *logFile = NULL;
|
FILE *logFile = NULL;
|
||||||
|
|
||||||
|
static const float kMinSeparatorStubX = 10;
|
||||||
|
static const float kStubToStringSlotX = 5;
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
const rgb_color kBlack = {0, 0, 0, 255};
|
const rgb_color kBlack = {0, 0, 0, 255};
|
||||||
const rgb_color kWhite = {255, 255, 255, 255};
|
const rgb_color kWhite = {255, 255, 255, 255};
|
||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
HashString(const char *string, uint32 seed)
|
HashString(const char *string, uint32 seed)
|
||||||
{
|
{
|
||||||
@@ -94,6 +99,7 @@ HashString(const char *string, uint32 seed)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
AttrHashString(const char *string, uint32 type)
|
AttrHashString(const char *string, uint32 type)
|
||||||
{
|
{
|
||||||
@@ -113,6 +119,7 @@ AttrHashString(const char *string, uint32 type)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ValidateStream(BMallocIO *stream, uint32 key, int32 version)
|
ValidateStream(BMallocIO *stream, uint32 key, int32 version)
|
||||||
{
|
{
|
||||||
@@ -126,6 +133,7 @@ ValidateStream(BMallocIO *stream, uint32 key, int32 version)
|
|||||||
return test_key == key && test_version == version;
|
return test_key == key && test_version == version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DisallowFilenameKeys(BTextView *textView)
|
DisallowFilenameKeys(BTextView *textView)
|
||||||
{
|
{
|
||||||
@@ -133,6 +141,7 @@ DisallowFilenameKeys(BTextView *textView)
|
|||||||
textView->DisallowChar('/');
|
textView->DisallowChar('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DisallowMetaKeys(BTextView *textView)
|
DisallowMetaKeys(BTextView *textView)
|
||||||
{
|
{
|
||||||
@@ -149,6 +158,7 @@ DisallowMetaKeys(BTextView *textView)
|
|||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PoseInfo::EndianSwap(void *castToThis)
|
PoseInfo::EndianSwap(void *castToThis)
|
||||||
{
|
{
|
||||||
@@ -170,6 +180,7 @@ PoseInfo::EndianSwap(void *castToThis)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PoseInfo::PrintToStream()
|
PoseInfo::PrintToStream()
|
||||||
{
|
{
|
||||||
@@ -177,26 +188,31 @@ PoseInfo::PrintToStream()
|
|||||||
fInitedDirectory, fLocation.x, fLocation.y));
|
fInitedDirectory, fLocation.x, fLocation.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ExtendedPoseInfo::Size() const
|
ExtendedPoseInfo::Size() const
|
||||||
{
|
{
|
||||||
return sizeof(ExtendedPoseInfo) + fNumFrames * sizeof(FrameLocation);
|
return sizeof(ExtendedPoseInfo) + fNumFrames * sizeof(FrameLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ExtendedPoseInfo::Size(int32 count)
|
ExtendedPoseInfo::Size(int32 count)
|
||||||
{
|
{
|
||||||
return sizeof(ExtendedPoseInfo) + count * sizeof(FrameLocation);
|
return sizeof(ExtendedPoseInfo) + count * sizeof(FrameLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ExtendedPoseInfo::SizeWithHeadroom() const
|
ExtendedPoseInfo::SizeWithHeadroom() const
|
||||||
{
|
{
|
||||||
return sizeof(ExtendedPoseInfo) + (fNumFrames + 1) * sizeof(FrameLocation);
|
return sizeof(ExtendedPoseInfo) + (fNumFrames + 1) * sizeof(FrameLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ExtendedPoseInfo::SizeWithHeadroom(size_t oldSize)
|
ExtendedPoseInfo::SizeWithHeadroom(size_t oldSize)
|
||||||
{
|
{
|
||||||
@@ -213,34 +229,41 @@ ExtendedPoseInfo::SizeWithHeadroom(size_t oldSize)
|
|||||||
bool
|
bool
|
||||||
ExtendedPoseInfo::HasLocationForFrame(BRect frame) const
|
ExtendedPoseInfo::HasLocationForFrame(BRect frame) const
|
||||||
{
|
{
|
||||||
for (int32 index = 0; index < fNumFrames; index++)
|
for (int32 index = 0; index < fNumFrames; index++) {
|
||||||
if (fLocations[index].fFrame == frame)
|
if (fLocations[index].fFrame == frame)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPoint
|
BPoint
|
||||||
ExtendedPoseInfo::LocationForFrame(BRect frame) const
|
ExtendedPoseInfo::LocationForFrame(BRect frame) const
|
||||||
{
|
{
|
||||||
for (int32 index = 0; index < fNumFrames; index++)
|
for (int32 index = 0; index < fNumFrames; index++) {
|
||||||
if (fLocations[index].fFrame == frame)
|
if (fLocations[index].fFrame == frame)
|
||||||
return fLocations[index].fLocation;
|
return fLocations[index].fLocation;
|
||||||
|
}
|
||||||
|
|
||||||
TRESPASS();
|
TRESPASS();
|
||||||
return BPoint(0, 0);
|
return BPoint(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame)
|
ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame)
|
||||||
{
|
{
|
||||||
for (int32 index = 0; index < fNumFrames; index++)
|
for (int32 index = 0; index < fNumFrames; index++) {
|
||||||
if (fLocations[index].fFrame == frame) {
|
if (fLocations[index].fFrame == frame) {
|
||||||
if (fLocations[index].fLocation == newLocation)
|
if (fLocations[index].fLocation == newLocation)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fLocations[index].fLocation = newLocation;
|
fLocations[index].fLocation = newLocation;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fLocations[fNumFrames].fFrame = frame;
|
fLocations[fNumFrames].fFrame = frame;
|
||||||
fLocations[fNumFrames].fLocation = newLocation;
|
fLocations[fNumFrames].fLocation = newLocation;
|
||||||
fLocations[fNumFrames].fWorkspaces = 0xffffffff;
|
fLocations[fNumFrames].fWorkspaces = 0xffffffff;
|
||||||
@@ -248,6 +271,7 @@ ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ExtendedPoseInfo::EndianSwap(void *castToThis)
|
ExtendedPoseInfo::EndianSwap(void *castToThis)
|
||||||
{
|
{
|
||||||
@@ -275,29 +299,37 @@ ExtendedPoseInfo::EndianSwap(void *castToThis)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ExtendedPoseInfo::PrintToStream()
|
ExtendedPoseInfo::PrintToStream()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
OffscreenBitmap::OffscreenBitmap(BRect frame)
|
OffscreenBitmap::OffscreenBitmap(BRect frame)
|
||||||
: fBitmap(NULL)
|
:
|
||||||
|
fBitmap(NULL)
|
||||||
{
|
{
|
||||||
NewBitmap(frame);
|
NewBitmap(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OffscreenBitmap::OffscreenBitmap()
|
OffscreenBitmap::OffscreenBitmap()
|
||||||
: fBitmap(NULL)
|
:
|
||||||
|
fBitmap(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OffscreenBitmap::~OffscreenBitmap()
|
OffscreenBitmap::~OffscreenBitmap()
|
||||||
{
|
{
|
||||||
delete fBitmap;
|
delete fBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OffscreenBitmap::NewBitmap(BRect bounds)
|
OffscreenBitmap::NewBitmap(BRect bounds)
|
||||||
{
|
{
|
||||||
@@ -319,21 +351,25 @@ OffscreenBitmap::NewBitmap(BRect bounds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView *
|
BView *
|
||||||
OffscreenBitmap::BeginUsing(BRect frame)
|
OffscreenBitmap::BeginUsing(BRect frame)
|
||||||
{
|
{
|
||||||
if (!fBitmap || fBitmap->Bounds() != frame)
|
if (!fBitmap || fBitmap->Bounds() != frame)
|
||||||
NewBitmap(frame);
|
NewBitmap(frame);
|
||||||
|
|
||||||
fBitmap->Lock();
|
fBitmap->Lock();
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OffscreenBitmap::DoneUsing()
|
OffscreenBitmap::DoneUsing()
|
||||||
{
|
{
|
||||||
fBitmap->Unlock();
|
fBitmap->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BBitmap *
|
BBitmap *
|
||||||
OffscreenBitmap::Bitmap() const
|
OffscreenBitmap::Bitmap() const
|
||||||
{
|
{
|
||||||
@@ -342,6 +378,7 @@ OffscreenBitmap::Bitmap() const
|
|||||||
return fBitmap;
|
return fBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView *
|
BView *
|
||||||
OffscreenBitmap::View() const
|
OffscreenBitmap::View() const
|
||||||
{
|
{
|
||||||
@@ -432,11 +469,11 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to
|
|||||||
|
|
||||||
|
|
||||||
DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType,
|
DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType,
|
||||||
icon_size size, const BMessage *message, BMessenger target, uint32 resizeMask,
|
icon_size size, const BMessage *message, BMessenger target,
|
||||||
uint32 flags)
|
uint32 resizeMask, uint32 flags)
|
||||||
: BView(rect, name, resizeMask, flags),
|
: BView(rect, name, resizeMask, flags),
|
||||||
fMessage(*message),
|
fMessage(*message),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
fBitmap = new BBitmap(Bounds(), kDefaultIconDepth);
|
fBitmap = new BBitmap(Bounds(), kDefaultIconDepth);
|
||||||
BMimeType mime(mimeType);
|
BMimeType mime(mimeType);
|
||||||
@@ -451,16 +488,18 @@ DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DraggableIcon::~DraggableIcon()
|
||||||
|
{
|
||||||
|
delete fBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableIcon::SetTarget(BMessenger target)
|
DraggableIcon::SetTarget(BMessenger target)
|
||||||
{
|
{
|
||||||
fTarget = target;
|
fTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
DraggableIcon::~DraggableIcon()
|
|
||||||
{
|
|
||||||
delete fBitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
DraggableIcon::PreferredRect(BPoint offset, icon_size size)
|
DraggableIcon::PreferredRect(BPoint offset, icon_size size)
|
||||||
@@ -470,6 +509,7 @@ DraggableIcon::PreferredRect(BPoint offset, icon_size size)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableIcon::AttachedToWindow()
|
DraggableIcon::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -480,6 +520,7 @@ DraggableIcon::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableIcon::MouseDown(BPoint point)
|
DraggableIcon::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
@@ -501,8 +542,8 @@ DraggableIcon::MouseDown(BPoint point)
|
|||||||
view->SetHighColor(0, 0, 0, 0);
|
view->SetHighColor(0, 0, 0, 0);
|
||||||
view->FillRect(view->Bounds());
|
view->FillRect(view->Bounds());
|
||||||
view->SetDrawingMode(B_OP_ALPHA);
|
view->SetDrawingMode(B_OP_ALPHA);
|
||||||
view->SetHighColor(0, 0, 0, 128); // set the level of transparency by
|
view->SetHighColor(0, 0, 0, 128);
|
||||||
// value
|
// set the level of transparency by value
|
||||||
view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
|
view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
|
||||||
view->DrawBitmap(fBitmap);
|
view->DrawBitmap(fBitmap);
|
||||||
view->Sync();
|
view->Sync();
|
||||||
@@ -510,12 +551,14 @@ DraggableIcon::MouseDown(BPoint point)
|
|||||||
DragMessage(&fMessage, dragBitmap, B_OP_ALPHA, point, fTarget.Target(0));
|
DragMessage(&fMessage, dragBitmap, B_OP_ALPHA, point, fTarget.Target(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DraggableIcon::DragStarted(BMessage *)
|
DraggableIcon::DragStarted(BMessage *)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableIcon::Draw(BRect)
|
DraggableIcon::Draw(BRect)
|
||||||
{
|
{
|
||||||
@@ -523,29 +566,34 @@ DraggableIcon::Draw(BRect)
|
|||||||
DrawBitmap(fBitmap);
|
DrawBitmap(fBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
||||||
const char *text, uint32 resizeFlags, uint32 flags)
|
const char *text, uint32 resizeFlags, uint32 flags)
|
||||||
: BStringView(bounds, name, text, resizeFlags, flags),
|
: BStringView(bounds, name, text, resizeFlags, flags),
|
||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fOrigBitmap(NULL)
|
fOrigBitmap(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
||||||
const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags)
|
const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags)
|
||||||
: BStringView(bounds, name, text, resizeFlags, flags),
|
: BStringView(bounds, name, text, resizeFlags, flags),
|
||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fOrigBitmap(inBitmap)
|
fOrigBitmap(inBitmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FlickerFreeStringView::~FlickerFreeStringView()
|
FlickerFreeStringView::~FlickerFreeStringView()
|
||||||
{
|
{
|
||||||
delete fBitmap;
|
delete fBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FlickerFreeStringView::Draw(BRect)
|
FlickerFreeStringView::Draw(BRect)
|
||||||
{
|
{
|
||||||
@@ -583,28 +631,28 @@ FlickerFreeStringView::Draw(BRect)
|
|||||||
edge_info eInfo;
|
edge_info eInfo;
|
||||||
switch (Alignment()) {
|
switch (Alignment()) {
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
{
|
{
|
||||||
// If the first char has a negative left edge give it
|
// If the first char has a negative left edge give it
|
||||||
// some more room by shifting that much more to the right.
|
// some more room by shifting that much more to the right.
|
||||||
font.GetEdges(Text(), 1, &eInfo);
|
font.GetEdges(Text(), 1, &eInfo);
|
||||||
loc.x = bounds.left + (2 - eInfo.left);
|
loc.x = bounds.left + (2 - eInfo.left);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_ALIGN_CENTER:
|
case B_ALIGN_CENTER:
|
||||||
{
|
{
|
||||||
float width = StringWidth(Text());
|
float width = StringWidth(Text());
|
||||||
float center = (bounds.right - bounds.left) / 2;
|
float center = (bounds.right - bounds.left) / 2;
|
||||||
loc.x = center - (width/2);
|
loc.x = center - (width/2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_ALIGN_RIGHT:
|
case B_ALIGN_RIGHT:
|
||||||
{
|
{
|
||||||
float width = StringWidth(Text());
|
float width = StringWidth(Text());
|
||||||
loc.x = bounds.right - width - 2;
|
loc.x = bounds.right - width - 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loc.y = bounds.bottom - (1 + height.descent);
|
loc.y = bounds.bottom - (1 + height.descent);
|
||||||
offscreen->MovePenTo(loc);
|
offscreen->MovePenTo(loc);
|
||||||
@@ -616,6 +664,7 @@ FlickerFreeStringView::Draw(BRect)
|
|||||||
fBitmap->DoneUsing();
|
fBitmap->DoneUsing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FlickerFreeStringView::AttachedToWindow()
|
FlickerFreeStringView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -628,6 +677,7 @@ FlickerFreeStringView::AttachedToWindow()
|
|||||||
SetLowColor(B_TRANSPARENT_32_BIT);
|
SetLowColor(B_TRANSPARENT_32_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FlickerFreeStringView::SetViewColor(rgb_color color)
|
FlickerFreeStringView::SetViewColor(rgb_color color)
|
||||||
{
|
{
|
||||||
@@ -638,6 +688,7 @@ FlickerFreeStringView::SetViewColor(rgb_color color)
|
|||||||
_inherited::SetViewColor(B_TRANSPARENT_32_BIT);
|
_inherited::SetViewColor(B_TRANSPARENT_32_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FlickerFreeStringView::SetLowColor(rgb_color color)
|
FlickerFreeStringView::SetLowColor(rgb_color color)
|
||||||
{
|
{
|
||||||
@@ -648,10 +699,12 @@ FlickerFreeStringView::SetLowColor(rgb_color color)
|
|||||||
_inherited::SetLowColor(B_TRANSPARENT_32_BIT);
|
_inherited::SetLowColor(B_TRANSPARENT_32_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
TitledSeparatorItem::TitledSeparatorItem(const char *label)
|
TitledSeparatorItem::TitledSeparatorItem(const char *label)
|
||||||
: BMenuItem(label, 0)
|
: BMenuItem(label, 0)
|
||||||
{
|
{
|
||||||
_inherited::SetEnabled(false);
|
_inherited::SetEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -661,20 +714,20 @@ TitledSeparatorItem::~TitledSeparatorItem()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TitledSeparatorItem::SetEnabled(bool)
|
TitledSeparatorItem::SetEnabled(bool)
|
||||||
{
|
{
|
||||||
// leave disabled
|
// leave disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TitledSeparatorItem::GetContentSize(float *width, float *height)
|
TitledSeparatorItem::GetContentSize(float *width, float *height)
|
||||||
{
|
{
|
||||||
_inherited::GetContentSize(width, height);
|
_inherited::GetContentSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float kMinSeparatorStubX = 10;
|
|
||||||
const float kStubToStringSlotX = 5;
|
|
||||||
|
|
||||||
inline rgb_color
|
inline rgb_color
|
||||||
ShiftMenuBackgroundColor(float by)
|
ShiftMenuBackgroundColor(float by)
|
||||||
@@ -682,6 +735,7 @@ ShiftMenuBackgroundColor(float by)
|
|||||||
return tint_color(ui_color(B_MENU_BACKGROUND_COLOR), by);
|
return tint_color(ui_color(B_MENU_BACKGROUND_COLOR), by);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TitledSeparatorItem::Draw()
|
TitledSeparatorItem::Draw()
|
||||||
{
|
{
|
||||||
@@ -774,18 +828,21 @@ TitledSeparatorItem::Draw()
|
|||||||
parent->PopState();
|
parent->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier,
|
ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier,
|
||||||
uint32 shortcutWhat, BHandler *target)
|
uint32 shortcutWhat, BHandler *target)
|
||||||
: BMessageFilter(B_KEY_DOWN),
|
: BMessageFilter(B_KEY_DOWN),
|
||||||
fShortcutKey(shortcutKey),
|
fShortcutKey(shortcutKey),
|
||||||
fShortcutModifier(shortcutModifier),
|
fShortcutModifier(shortcutModifier),
|
||||||
fShortcutWhat(shortcutWhat),
|
fShortcutWhat(shortcutWhat),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
filter_result
|
filter_result
|
||||||
ShortcutFilter::Filter(BMessage *message, BHandler **)
|
ShortcutFilter::Filter(BMessage *message, BHandler **)
|
||||||
{
|
{
|
||||||
@@ -815,7 +872,10 @@ ShortcutFilter::Filter(BMessage *message, BHandler **)
|
|||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -920,6 +980,7 @@ MatchArchivedVolume(BVolume *result, const BMessage *message, int32 index)
|
|||||||
return B_DEV_BAD_DRIVE_NUM;
|
return B_DEV_BAD_DRIVE_NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StringFromStream(BString *string, BMallocIO *stream, bool endianSwap)
|
StringFromStream(BString *string, BMallocIO *stream, bool endianSwap)
|
||||||
{
|
{
|
||||||
@@ -940,6 +1001,7 @@ StringFromStream(BString *string, BMallocIO *stream, bool endianSwap)
|
|||||||
string->UnlockBuffer(length);
|
string->UnlockBuffer(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StringToStream(const BString *string, BMallocIO *stream)
|
StringToStream(const BString *string, BMallocIO *stream)
|
||||||
{
|
{
|
||||||
@@ -948,12 +1010,14 @@ StringToStream(const BString *string, BMallocIO *stream)
|
|||||||
stream->Write(string->String(), (size_t)string->Length() + 1);
|
stream->Write(string->String(), (size_t)string->Length() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
ArchiveSize(const BString *string)
|
ArchiveSize(const BString *string)
|
||||||
{
|
{
|
||||||
return string->Length() + 1 + (ssize_t)sizeof(int32);
|
return string->Length() + 1 + (ssize_t)sizeof(int32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
CountRefs(const BMessage *message)
|
CountRefs(const BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -964,6 +1028,7 @@ CountRefs(const BMessage *message)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static entry_ref *
|
static entry_ref *
|
||||||
EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
||||||
void *passThru, int32 maxCount)
|
void *passThru, int32 maxCount)
|
||||||
@@ -986,17 +1051,20 @@ EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContainsEntryRef(const BMessage *message, const entry_ref *ref)
|
ContainsEntryRef(const BMessage *message, const entry_ref *ref)
|
||||||
{
|
{
|
||||||
entry_ref match;
|
entry_ref match;
|
||||||
for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); index++)
|
for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); index++) {
|
||||||
if (*ref == match)
|
if (*ref == match)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
entry_ref *
|
entry_ref *
|
||||||
EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
||||||
void *passThru)
|
void *passThru)
|
||||||
@@ -1006,13 +1074,15 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
|||||||
|
|
||||||
typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *);
|
typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *);
|
||||||
|
|
||||||
const entry_ref *EachEntryRef(const BMessage *message,
|
const entry_ref *
|
||||||
const entry_ref *(*func)(const entry_ref *, void *), void *passThru)
|
EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *),
|
||||||
|
void *passThru)
|
||||||
{
|
{
|
||||||
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
||||||
(EachEntryIteratee)func, passThru, -1);
|
(EachEntryIteratee)func, passThru, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
entry_ref *
|
entry_ref *
|
||||||
EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
||||||
void *passThru, int32 maxCount)
|
void *passThru, int32 maxCount)
|
||||||
@@ -1020,6 +1090,7 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
|||||||
return EachEntryRefCommon(message, func, passThru, maxCount);
|
return EachEntryRefCommon(message, func, passThru, maxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const entry_ref *
|
const entry_ref *
|
||||||
EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *),
|
EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *),
|
||||||
void *passThru, int32 maxCount)
|
void *passThru, int32 maxCount)
|
||||||
@@ -1028,16 +1099,19 @@ EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *
|
|||||||
(EachEntryIteratee)func, passThru, maxCount);
|
(EachEntryIteratee)func, passThru, maxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TruncateLeaf(BString *string)
|
TruncateLeaf(BString *string)
|
||||||
{
|
{
|
||||||
for (int32 index = string->Length(); index >= 0; index--)
|
for (int32 index = string->Length(); index >= 0; index--) {
|
||||||
if ((*string)[index] == '/') {
|
if ((*string)[index] == '/') {
|
||||||
string->Truncate(index + 1);
|
string->Truncate(index + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64
|
int64
|
||||||
StringToScalar(const char *text)
|
StringToScalar(const char *text)
|
||||||
{
|
{
|
||||||
@@ -1059,9 +1133,10 @@ StringToScalar(const char *text)
|
|||||||
} else if (strstr(buffer, "byte") || strstr(buffer, "BYTE")) {
|
} else if (strstr(buffer, "byte") || strstr(buffer, "BYTE")) {
|
||||||
val = strtoll(buffer, &end, 10);
|
val = strtoll(buffer, &end, 10);
|
||||||
val *= kGBSize;
|
val *= kGBSize;
|
||||||
} else
|
} else {
|
||||||
// no suffix, try plain byte conversion
|
// no suffix, try plain byte conversion
|
||||||
val = strtoll(buffer, &end, 10);
|
val = strtoll(buffer, &end, 10);
|
||||||
|
}
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return val;
|
return val;
|
||||||
@@ -1078,6 +1153,7 @@ operator==(const rgb_color &a, const rgb_color &b)
|
|||||||
&& a.alpha == b.alpha;
|
&& a.alpha == b.alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const rgb_color &a, const rgb_color &b)
|
operator!=(const rgb_color &a, const rgb_color &b)
|
||||||
{
|
{
|
||||||
@@ -1086,6 +1162,7 @@ operator!=(const rgb_color &a, const rgb_color &b)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static BRect
|
static BRect
|
||||||
LineBounds(BPoint where, float length, bool vertical)
|
LineBounds(BPoint where, float length, bool vertical)
|
||||||
{
|
{
|
||||||
@@ -1100,14 +1177,16 @@ LineBounds(BPoint where, float length, bool vertical)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, const char *name)
|
SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, const char *name)
|
||||||
: BView(LineBounds(where, length, vertical), name,
|
: BView(LineBounds(where, length, vertical), name,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW)
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SeparatorLine::Draw(BRect)
|
SeparatorLine::Draw(BRect)
|
||||||
{
|
{
|
||||||
@@ -1126,6 +1205,7 @@ SeparatorLine::Draw(BRect)
|
|||||||
EndLineArray();
|
EndLineArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HexDump(const void *buf, int32 length)
|
HexDump(const void *buf, int32 length)
|
||||||
{
|
{
|
||||||
@@ -1140,7 +1220,6 @@ HexDump(const void *buf, int32 length)
|
|||||||
printf( "0x%06x: ", (int)offset);
|
printf( "0x%06x: ", (int)offset);
|
||||||
|
|
||||||
for (index = 0; index < kBytesPerLine; index++) {
|
for (index = 0; index < kBytesPerLine; index++) {
|
||||||
|
|
||||||
if (remain-- > 0)
|
if (remain-- > 0)
|
||||||
printf("%02x%c", buffer[index], remain > 0 ? ',' : ' ');
|
printf("%02x%c", buffer[index], remain > 0 ? ',' : ' ');
|
||||||
else
|
else
|
||||||
@@ -1150,7 +1229,6 @@ HexDump(const void *buf, int32 length)
|
|||||||
remain = length;
|
remain = length;
|
||||||
printf(" \'");
|
printf(" \'");
|
||||||
for (index = 0; index < kBytesPerLine; index++) {
|
for (index = 0; index < kBytesPerLine; index++) {
|
||||||
|
|
||||||
if (remain-- > 0)
|
if (remain-- > 0)
|
||||||
printf("%c", buffer[index] > ' ' ? buffer[index] : '.');
|
printf("%c", buffer[index] > ' ' ? buffer[index] : '.');
|
||||||
else
|
else
|
||||||
@@ -1161,11 +1239,11 @@ HexDump(const void *buf, int32 length)
|
|||||||
length -= kBytesPerLine;
|
length -= kBytesPerLine;
|
||||||
if (length <= 0)
|
if (length <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EnableNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
EnableNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
||||||
{
|
{
|
||||||
@@ -1174,6 +1252,7 @@ EnableNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
|||||||
item->SetEnabled(on);
|
item->SetEnabled(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
MarkNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
||||||
{
|
{
|
||||||
@@ -1182,6 +1261,7 @@ MarkNamedMenuItem(BMenu *menu, const char *itemName, bool on)
|
|||||||
item->SetMarked(on);
|
item->SetMarked(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EnableNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
EnableNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
||||||
{
|
{
|
||||||
@@ -1190,6 +1270,7 @@ EnableNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
|||||||
item->SetEnabled(on);
|
item->SetEnabled(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
MarkNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
||||||
{
|
{
|
||||||
@@ -1198,6 +1279,7 @@ MarkNamedMenuItem(BMenu *menu, uint32 commandName, bool on)
|
|||||||
item->SetMarked(on);
|
item->SetMarked(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DeleteSubmenu(BMenuItem *submenuItem)
|
DeleteSubmenu(BMenuItem *submenuItem)
|
||||||
{
|
{
|
||||||
@@ -1217,6 +1299,7 @@ DeleteSubmenu(BMenuItem *submenuItem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
GetAppSignatureFromAttr(BFile *file, char *result)
|
GetAppSignatureFromAttr(BFile *file, char *result)
|
||||||
{
|
{
|
||||||
@@ -1226,12 +1309,9 @@ GetAppSignatureFromAttr(BFile *file, char *result)
|
|||||||
// the resource fork is scanned to read the attribute
|
// the resource fork is scanned to read the attribute
|
||||||
|
|
||||||
#ifdef B_APP_FILE_INFO_IS_FAST
|
#ifdef B_APP_FILE_INFO_IS_FAST
|
||||||
|
|
||||||
BAppFileInfo appFileInfo(file);
|
BAppFileInfo appFileInfo(file);
|
||||||
return appFileInfo.GetSignature(result);
|
return appFileInfo.GetSignature(result);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
ssize_t readResult = file->ReadAttr(kAttrAppSignature, B_MIME_STRING_TYPE,
|
ssize_t readResult = file->ReadAttr(kAttrAppSignature, B_MIME_STRING_TYPE,
|
||||||
0, result, B_MIME_TYPE_LENGTH);
|
0, result, B_MIME_TYPE_LENGTH);
|
||||||
|
|
||||||
@@ -1239,10 +1319,10 @@ GetAppSignatureFromAttr(BFile *file, char *result)
|
|||||||
return (status_t)readResult;
|
return (status_t)readResult;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
#endif // B_APP_FILE_INFO_IS_FAST
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
|
GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
|
||||||
{
|
{
|
||||||
@@ -1252,12 +1332,9 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
|
|||||||
// the resource fork is scanned to read the icons
|
// the resource fork is scanned to read the icons
|
||||||
|
|
||||||
#ifdef B_APP_FILE_INFO_IS_FAST
|
#ifdef B_APP_FILE_INFO_IS_FAST
|
||||||
|
|
||||||
BAppFileInfo appFileInfo(file);
|
BAppFileInfo appFileInfo(file);
|
||||||
return appFileInfo.GetIcon(result, size);
|
return appFileInfo.GetIcon(result, size);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
const char *attrName = size == B_LARGE_ICON ? kAttrLargeIcon : kAttrMiniIcon;
|
const char *attrName = size == B_LARGE_ICON ? kAttrLargeIcon : kAttrMiniIcon;
|
||||||
uint32 type = size == B_LARGE_ICON ? LARGE_ICON_TYPE : MINI_ICON_TYPE;
|
uint32 type = size == B_LARGE_ICON ? LARGE_ICON_TYPE : MINI_ICON_TYPE;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@@ -1268,17 +1345,16 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
ssize_t readResult = file->ReadAttr(attrName, type, 0, buffer, (size_t)ainfo.size);
|
ssize_t readResult = file->ReadAttr(attrName, type, 0, buffer, (size_t)ainfo.size);
|
||||||
|
|
||||||
if (readResult <= 0)
|
if (readResult <= 0)
|
||||||
return (status_t)readResult;
|
return (status_t)readResult;
|
||||||
|
|
||||||
result->SetBits(buffer, result->BitsLength(), 0, B_COLOR_8_BIT);
|
result->SetBits(buffer, result->BitsLength(), 0, B_CMAP8);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
#endif // B_APP_FILE_INFO_IS_FAST
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
GetFileIconFromAttr(BNode *file, BBitmap *result, icon_size size)
|
GetFileIconFromAttr(BNode *file, BBitmap *result, icon_size size)
|
||||||
{
|
{
|
||||||
@@ -1286,6 +1362,7 @@ GetFileIconFromAttr(BNode *file, BBitmap *result, icon_size size)
|
|||||||
return fileInfo.GetIcon(result, size);
|
return fileInfo.GetIcon(result, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PrintToStream(rgb_color color)
|
PrintToStream(rgb_color color)
|
||||||
{
|
{
|
||||||
@@ -1303,6 +1380,7 @@ EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *))
|
|||||||
BMenuItem *result = (func)(item);
|
BMenuItem *result = (func)(item);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
BMenu *submenu = menu->SubmenuAt(index);
|
BMenu *submenu = menu->SubmenuAt(index);
|
||||||
if (submenu)
|
if (submenu)
|
||||||
@@ -1313,6 +1391,7 @@ EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *))
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern const BMenuItem *
|
extern const BMenuItem *
|
||||||
EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuItem *))
|
EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuItem *))
|
||||||
{
|
{
|
||||||
@@ -1322,6 +1401,7 @@ EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuIt
|
|||||||
BMenuItem *result = (func)(item);
|
BMenuItem *result = (func)(item);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
BMenu *submenu = menu->SubmenuAt(index);
|
BMenu *submenu = menu->SubmenuAt(index);
|
||||||
if (submenu)
|
if (submenu)
|
||||||
@@ -1332,18 +1412,21 @@ EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuIt
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PositionPassingMenuItem::PositionPassingMenuItem(const char *title,
|
PositionPassingMenuItem::PositionPassingMenuItem(const char *title,
|
||||||
BMessage *message, char shortcut, uint32 modifiers)
|
BMessage *message, char shortcut, uint32 modifiers)
|
||||||
: BMenuItem(title, message, shortcut, modifiers)
|
: BMenuItem(title, message, shortcut, modifiers)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu,
|
PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu,
|
||||||
BMessage *message)
|
BMessage *message)
|
||||||
: BMenuItem(menu, message)
|
: BMenuItem(menu, message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
PositionPassingMenuItem::Invoke(BMessage *message)
|
PositionPassingMenuItem::Invoke(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -1376,8 +1459,7 @@ PositionPassingMenuItem::Invoke(BMessage *message)
|
|||||||
|
|
||||||
// use the window position only, if the item was invoked from the menu
|
// use the window position only, if the item was invoked from the menu
|
||||||
// menu->Window() points to the window the item was invoked from
|
// menu->Window() points to the window the item was invoked from
|
||||||
if (dynamic_cast<BContainerWindow *>(menu->Window()) == NULL)
|
if (dynamic_cast<BContainerWindow *>(menu->Window()) == NULL) {
|
||||||
{
|
|
||||||
LooperAutoLocker lock(menu);
|
LooperAutoLocker lock(menu);
|
||||||
if (lock.IsLocked()) {
|
if (lock.IsLocked()) {
|
||||||
BPoint invokeOrigin(menu->Window()->Frame().LeftTop());
|
BPoint invokeOrigin(menu->Window()->Frame().LeftTop());
|
||||||
@@ -1388,6 +1470,7 @@ PositionPassingMenuItem::Invoke(BMessage *message)
|
|||||||
return BInvoker::Invoke(&clone);
|
return BInvoker::Invoke(&clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BootedInSafeMode()
|
BootedInSafeMode()
|
||||||
{
|
{
|
||||||
@@ -1405,6 +1488,7 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(lin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
||||||
{
|
{
|
||||||
@@ -1414,6 +1498,7 @@ _ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(lin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString),
|
_ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString),
|
||||||
const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const int64 kTBSize = kGBSize * kKBSize;
|
|||||||
|
|
||||||
const int32 kMiniIconSeparator = 3;
|
const int32 kMiniIconSeparator = 3;
|
||||||
|
|
||||||
const color_space kDefaultIconDepth = B_COLOR_8_BIT;
|
const color_space kDefaultIconDepth = B_CMAP8;
|
||||||
|
|
||||||
// misc typedefs, constants and structs
|
// misc typedefs, constants and structs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user