More style cleanup patches from John Scipione as part of #7052.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40847 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Fredrik Holmqvist 2011-03-06 15:57:48 +00:00
parent e0728fa558
commit 1ad8c760ed
10 changed files with 224 additions and 212 deletions

View File

@ -35,8 +35,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
// Controls // Controls
fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"), fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentApplications = new BCheckBox( fMenuRecentApplications = new BCheckBox(B_TRANSLATE("Recent applications:"),
B_TRANSLATE("Recent applications:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"), fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
@ -52,8 +51,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
new BMessage(kSortRunningApps)); new BMessage(kSortRunningApps));
fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"), fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"),
new BMessage(kTrackerFirst)); new BMessage(kTrackerFirst));
fAppsShowExpanders = new BCheckBox( fAppsShowExpanders = new BCheckBox(B_TRANSLATE("Show application expander"),
B_TRANSLATE("Show application expander"),
new BMessage(kSuperExpando)); new BMessage(kSuperExpando));
fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"),
new BMessage(kExpandNewTeams)); new BMessage(kExpandNewTeams));
@ -83,7 +81,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
// Values // Values
TBarApp* barApp = static_cast<TBarApp*>(be_app); TBarApp* barApp = static_cast<TBarApp*>(be_app);
desk_settings* appSettings = barApp->Settings();; desk_settings* appSettings = barApp->Settings();
fAppsSort->SetValue(appSettings->sortRunningApps); fAppsSort->SetValue(appSettings->sortRunningApps);
fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst);

View File

@ -28,8 +28,8 @@ public:
PreferencesWindow(BRect frame); PreferencesWindow(BRect frame);
~PreferencesWindow(); ~PreferencesWindow();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
private: private:
void _UpdateRecentCounts(); void _UpdateRecentCounts();

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
@ -70,78 +71,78 @@ namespace TResourcePrivate {
: fDeleteOK(false) : fDeleteOK(false)
{ {
} }
virtual ~TypeObject() virtual ~TypeObject()
{ {
if (!fDeleteOK) if (!fDeleteOK)
debugger("deleting object owned by BResourceSet"); debugger("deleting object owned by BResourceSet");
} }
void Delete() void Delete()
{ {
fDeleteOK = true; fDeleteOK = true;
} }
private: private:
TypeObject(const TypeObject &); TypeObject(const TypeObject &);
TypeObject &operator=(const TypeObject &); TypeObject &operator=(const TypeObject &);
bool operator==(const TypeObject &); bool operator==(const TypeObject &);
bool operator!=(const TypeObject &); bool operator!=(const TypeObject &);
bool fDeleteOK; bool fDeleteOK;
}; };
class BitmapTypeItem : public BBitmap, public TypeObject { class BitmapTypeItem : public BBitmap, public TypeObject {
public: public:
BitmapTypeItem(BRect bounds, uint32 flags, color_space depth, BitmapTypeItem(BRect bounds, uint32 flags, color_space depth,
int32 bytesPerRow=B_ANY_BYTES_PER_ROW, screen_id screenID int32 bytesPerRow = B_ANY_BYTES_PER_ROW, screen_id screenID
= B_MAIN_SCREEN_ID) = B_MAIN_SCREEN_ID)
: BBitmap(bounds, flags, depth, bytesPerRow, screenID) : BBitmap(bounds, flags, depth, bytesPerRow, screenID)
{ {
} }
BitmapTypeItem(const BBitmap* source, bool accepts_views = false, BitmapTypeItem(const BBitmap* source, bool accepts_views = false,
bool need_contiguous = false) bool need_contiguous = false)
: BBitmap(source, accepts_views, need_contiguous) : BBitmap(source, accepts_views, need_contiguous)
{ {
} }
BitmapTypeItem(BMessage* data) BitmapTypeItem(BMessage* data)
: BBitmap(data) : BBitmap(data)
{ {
} }
virtual ~BitmapTypeItem() virtual ~BitmapTypeItem()
{ {
} }
}; };
class StringBlockTypeItem : public TStringBlock, public TypeObject { class StringBlockTypeItem : public TStringBlock, public TypeObject {
public: public:
StringBlockTypeItem(BDataIO* data) StringBlockTypeItem(BDataIO* data)
: TStringBlock(data) : TStringBlock(data)
{ {
} }
StringBlockTypeItem(const void* block, size_t size) StringBlockTypeItem(const void* block, size_t size)
: TStringBlock(block, size) : TStringBlock(block, size)
{ {
} }
virtual ~StringBlockTypeItem() virtual ~StringBlockTypeItem()
{ {
} }
}; };
class TypeItem { class TypeItem {
public: public:
TypeItem(int32 id, const char* name, const void* data, size_t size) TypeItem(int32 id, const char* name, const void* data, size_t size)
: fID(id), fName(name), : fID(id), fName(name),
fData(const_cast<void*>(data)), fSize(size), fObject(0), fData(const_cast<void*>(data)), fSize(size), fObject(0),
fOwnData(false), fSourceIsFile(false) fOwnData(false), fSourceIsFile(false)
{ {
} }
TypeItem(int32 id, const char* name, BFile* file) TypeItem(int32 id, const char* name, BFile* file)
: fID(id), : fID(id),
fName(name), fName(name),
@ -162,7 +163,7 @@ namespace TResourcePrivate {
} }
} }
} }
virtual ~TypeItem() virtual ~TypeItem()
{ {
if (fOwnData) { if (fOwnData) {
@ -172,19 +173,27 @@ namespace TResourcePrivate {
} }
SetObject(NULL); SetObject(NULL);
} }
int32 ID() const int32 ID() const
{ return fID; } {
return fID;
}
const char* Name() const const char* Name() const
{ return fName.String(); } {
return fName.String();
}
const void* Data() const const void* Data() const
{ return fData; } {
return fData;
}
size_t Size() const size_t Size() const
{ return fSize; } {
return fSize;
}
void SetObject(TypeObject* object) void SetObject(TypeObject* object)
{ {
if (object == fObject) if (object == fObject)
@ -195,14 +204,20 @@ namespace TResourcePrivate {
} }
TypeObject* Object() const TypeObject* Object() const
{ return fObject; } {
return fObject;
}
void SetSourceIsFile(bool state) void SetSourceIsFile(bool state)
{ fSourceIsFile = state; } {
fSourceIsFile = state;
}
bool SourceIsFile() const bool SourceIsFile() const
{ return fSourceIsFile; } {
return fSourceIsFile;
}
private: private:
int32 fID; int32 fID;
BString fName; BString fName;
@ -212,7 +227,7 @@ namespace TResourcePrivate {
bool fOwnData; bool fOwnData;
bool fSourceIsFile; bool fSourceIsFile;
}; };
static bool FreeTypeItemFunc(void* item) static bool FreeTypeItemFunc(void* item)
{ {
delete reinterpret_cast<TypeItem*>(item); delete reinterpret_cast<TypeItem*>(item);
@ -225,16 +240,18 @@ namespace TResourcePrivate {
: fType(type) : fType(type)
{ {
} }
virtual ~TypeList() virtual ~TypeList()
{ {
fItems.DoForEach(FreeTypeItemFunc); fItems.DoForEach(FreeTypeItemFunc);
fItems.MakeEmpty(); fItems.MakeEmpty();
} }
type_code Type() const type_code Type() const
{ return fType; } {
return fType;
}
TypeItem* FindItemByID(int32 id) TypeItem* FindItemByID(int32 id)
{ {
for (int32 i = 0; i < fItems.CountItems(); i++ ) { for (int32 i = 0; i < fItems.CountItems(); i++ ) {
@ -254,17 +271,16 @@ namespace TResourcePrivate {
} }
return NULL; return NULL;
} }
void AddItem(TypeItem* item) void AddItem(TypeItem* item)
{ {
fItems.AddItem(item); fItems.AddItem(item);
} }
private: private:
type_code fType; type_code fType;
BList fItems; BList fItems;
}; };
} }
using namespace TResourcePrivate; using namespace TResourcePrivate;
@ -282,13 +298,13 @@ TStringBlock::TStringBlock(BDataIO* data)
fStrings = (char*)malloc(1024); fStrings = (char*)malloc(1024);
size_t pos = 0; size_t pos = 0;
ssize_t amount; ssize_t amount;
while ((amount=data->Read(fStrings + pos, 1024)) == 1024) { while ((amount = data->Read(fStrings + pos, 1024)) == 1024) {
pos += amount; pos += amount;
fStrings = (char*)realloc(fStrings, pos + 1024); fStrings = (char*)realloc(fStrings, pos + 1024);
} }
if (amount > 0) if (amount > 0)
pos += amount; pos += amount;
fNumEntries = PreIndex(fStrings, amount); fNumEntries = PreIndex(fStrings, amount);
fIndex = (size_t*)malloc(sizeof(size_t) * fNumEntries); fIndex = (size_t*)malloc(sizeof(size_t) * fNumEntries);
MakeIndex(fStrings, amount, fNumEntries, fIndex); MakeIndex(fStrings, amount, fNumEntries, fIndex);
@ -304,7 +320,7 @@ TStringBlock::TStringBlock(const void* block, size_t size)
{ {
fIndex = (size_t*)const_cast<void*>(block); fIndex = (size_t*)const_cast<void*>(block);
fStrings = (char*)const_cast<void*>(block); fStrings = (char*)const_cast<void*>(block);
// Figure out how many entries there are. // Figure out how many entries there are.
size_t last_off = 0; size_t last_off = 0;
while (fIndex[fNumEntries] > last_off && fIndex[fNumEntries] < size ) { while (fIndex[fNumEntries] > last_off && fIndex[fNumEntries] < size ) {
@ -339,12 +355,12 @@ size_t
TStringBlock::PreIndex(char* strings, ssize_t len) TStringBlock::PreIndex(char* strings, ssize_t len)
{ {
size_t count = 0; size_t count = 0;
char* orig = strings; char* orig = strings;
char* end = strings + len; char* end = strings + len;
bool in_cr = false; bool in_cr = false;
bool first = true; bool first = true;
bool skipping = false; bool skipping = false;
while (orig < end) { while (orig < end) {
if (*orig == '\n' || *orig == '\r' || *orig == 0) { if (*orig == '\n' || *orig == '\r' || *orig == 0) {
if (!in_cr && *orig == '\r') if (!in_cr && *orig == '\r')
@ -371,30 +387,29 @@ TStringBlock::PreIndex(char* strings, ssize_t len)
case '\\': case '\\':
*strings = '\\'; *strings = '\\';
break; break;
case '\n': case '\n':
*strings = '\n'; *strings = '\n';
break; break;
case '\r': case '\r':
*strings = '\r'; *strings = '\r';
break; break;
case '\t': case '\t':
*strings = '\t'; *strings = '\t';
break; break;
default: default:
*strings = *orig; *strings = *orig;
break; break;
} }
} else } else
*strings = *orig; *strings = *orig;
orig++; orig++;
strings++; strings++;
} }
return count; return count;
} }
@ -405,7 +420,7 @@ TStringBlock::MakeIndex(const char* strings, ssize_t len,
{ {
*resultingIndex++ = 0; *resultingIndex++ = 0;
indexLength--; indexLength--;
ssize_t pos = 0; ssize_t pos = 0;
while (pos < len && indexLength > 0) { while (pos < len && indexLength > 0) {
if (strings[pos] == 0 ) { if (strings[pos] == 0 ) {
@ -475,7 +490,7 @@ TResourceSet::AddResources(BResources* RESOURCES_ONLY(resources))
#if USE_RESOURCES #if USE_RESOURCES
if (!resources) if (!resources)
return B_BAD_VALUE; return B_BAD_VALUE;
BAutolock lock(&fLock); BAutolock lock(&fLock);
status_t err = fResources.AddItem(resources) ? B_OK : B_ERROR; status_t err = fResources.AddItem(resources) ? B_OK : B_ERROR;
if (err != B_OK) if (err != B_OK)
@ -499,7 +514,7 @@ TResourceSet::AddDirectory(const char* fullPath)
delete path; delete path;
return err; return err;
} }
BAutolock lock(&fLock); BAutolock lock(&fLock);
err = fDirectories.AddItem(path) ? B_OK : B_ERROR; err = fDirectories.AddItem(path) ? B_OK : B_ERROR;
if (err != B_OK) if (err != B_OK)
@ -514,13 +529,13 @@ TResourceSet::AddEnvDirectory(const char* in, const char* defaultValue)
{ {
BString buf; BString buf;
status_t err = ExpandString(&buf, in); status_t err = ExpandString(&buf, in);
if (err != B_OK) { if (err != B_OK) {
if (defaultValue) if (defaultValue)
return AddDirectory(defaultValue); return AddDirectory(defaultValue);
return err; return err;
} }
return AddDirectory(buf.String()); return AddDirectory(buf.String());
} }
@ -529,11 +544,12 @@ status_t
TResourceSet::ExpandString(BString* out, const char* in) TResourceSet::ExpandString(BString* out, const char* in)
{ {
const char* start = in; const char* start = in;
while (*in) { while (*in) {
if (*in == '$') { if (*in == '$') {
if (start < in) if (start < in)
out->Append(start, (int32)(in - start)); out->Append(start, (int32)(in - start));
in++; in++;
char variableName[1024]; char variableName[1024];
size_t i = 0; size_t i = 0;
@ -545,25 +561,25 @@ TResourceSet::ExpandString(BString* out, const char* in)
if (*in) if (*in)
in++; in++;
} else } else {
while ((isalnum(*in) || *in == '_') && i while ((isalnum(*in) || *in == '_')
< sizeof(variableName) - 1) && i < sizeof(variableName) - 1)
variableName[i++] = *in++; variableName[i++] = *in++;
}
start = in; start = in;
variableName[i] = '\0'; variableName[i] = '\0';
const char* val = getenv(variableName); const char* val = getenv(variableName);
if (!val) { if (!val) {
PRINT(("Error: env var %s not found.\n", &variableName[0])); PRINT(("Error: env var %s not found.\n", &variableName[0]));
return B_NAME_NOT_FOUND; return B_NAME_NOT_FOUND;
} }
status_t err = ExpandString(out, val); status_t err = ExpandString(out, val);
if (err != B_OK) if (err != B_OK)
return err; return err;
} else if (*in == '\\') { } else if (*in == '\\') {
if (start < in) if (start < in)
out->Append(start, (int32)(in - start)); out->Append(start, (int32)(in - start));
@ -576,7 +592,7 @@ TResourceSet::ExpandString(BString* out, const char* in)
if (start < in) if (start < in)
out->Append(start, (int32)(in - start)); out->Append(start, (int32)(in - start));
return B_OK; return B_OK;
} }
@ -585,7 +601,7 @@ const void*
TResourceSet::FindResource(type_code type, int32 id, size_t* outSize) TResourceSet::FindResource(type_code type, int32 id, size_t* outSize)
{ {
TypeItem* item = FindItemID(type, id); TypeItem* item = FindItemID(type, id);
if (outSize) if (outSize)
*outSize = item ? item->Size() : 0; *outSize = item ? item->Size() : 0;
@ -597,7 +613,7 @@ const void*
TResourceSet::FindResource(type_code type, const char* name, size_t* outSize) TResourceSet::FindResource(type_code type, const char* name, size_t* outSize)
{ {
TypeItem* item = FindItemName(type, name); TypeItem* item = FindItemName(type, name);
if (outSize) if (outSize)
*outSize = item ? item->Size() : 0; *outSize = item ? item->Size() : 0;
@ -632,11 +648,12 @@ TResourceSet::FindStringBlock(type_code type, const char* name)
return ReturnStringBlockItem(FindItemName(type, name)); return ReturnStringBlockItem(FindItemName(type, name));
} }
const char* const char*
TResourceSet::FindString(type_code type, int32 id, uint32 index) TResourceSet::FindString(type_code type, int32 id, uint32 index)
{ {
const TStringBlock* stringBlock = FindStringBlock(type, id); const TStringBlock* stringBlock = FindStringBlock(type, id);
if (!stringBlock) if (!stringBlock)
return NULL; return NULL;
@ -648,25 +665,26 @@ const char*
TResourceSet::FindString(type_code type, const char* name, uint32 index) TResourceSet::FindString(type_code type, const char* name, uint32 index)
{ {
const TStringBlock* stringBlock = FindStringBlock(type, name); const TStringBlock* stringBlock = FindStringBlock(type, name);
if (!stringBlock) if (!stringBlock)
return NULL; return NULL;
return stringBlock->String(index); return stringBlock->String(index);
} }
TypeList* TypeList*
TResourceSet::FindTypeList(type_code type) TResourceSet::FindTypeList(type_code type)
{ {
BAutolock lock(&fLock); BAutolock lock(&fLock);
int32 count = fTypes.CountItems(); int32 count = fTypes.CountItems();
for (int32 i = 0; i < count; i++ ) { for (int32 i = 0; i < count; i++ ) {
TypeList* list = (TypeList*)fTypes.ItemAt(i); TypeList* list = (TypeList*)fTypes.ItemAt(i);
if (list && list->Type() == type) if (list && list->Type() == type)
return list; return list;
} }
return NULL; return NULL;
} }
@ -676,12 +694,13 @@ TResourceSet::FindItemID(type_code type, int32 id)
{ {
TypeList* list = FindTypeList(type); TypeList* list = FindTypeList(type);
TypeItem* item = NULL; TypeItem* item = NULL;
if (list) item = list->FindItemByID(id); if (list)
item = list->FindItemByID(id);
if (!item) if (!item)
item = LoadResource(type, id, 0, &list); item = LoadResource(type, id, 0, &list);
return item; return item;
} }
@ -691,13 +710,13 @@ TResourceSet::FindItemName(type_code type, const char* name)
{ {
TypeList* list = FindTypeList(type); TypeList* list = FindTypeList(type);
TypeItem* item = NULL; TypeItem* item = NULL;
if (list) if (list)
item = list->FindItemByName(name); item = list->FindItemByName(name);
if (!item) if (!item)
item = LoadResource(type, -1, name, &list); item = LoadResource(type, -1, name, &list);
return item; return item;
} }
@ -707,10 +726,10 @@ TResourceSet::LoadResource(type_code type, int32 id, const char* name,
TypeList** inOutList) TypeList** inOutList)
{ {
TypeItem* item = NULL; TypeItem* item = NULL;
if (name) { if (name) {
BEntry entry; BEntry entry;
// If a named resource, first look in directories. // If a named resource, first look in directories.
fLock.Lock(); fLock.Lock();
int32 count = fDirectories.CountItems(); int32 count = fDirectories.CountItems();
@ -731,7 +750,7 @@ TResourceSet::LoadResource(type_code type, int32 id, const char* name,
} }
fLock.Unlock(); fLock.Unlock();
} }
#if USE_RESOURCES #if USE_RESOURCES
if (!item) { if (!item) {
// Look through resource objects for data. // Look through resource objects for data.
@ -746,7 +765,7 @@ TResourceSet::LoadResource(type_code type, int32 id, const char* name,
data = resource->LoadResource(type, id, &size); data = resource->LoadResource(type, id, &size);
else if (name != NULL) else if (name != NULL)
data = resource->LoadResource(type, name, &size); data = resource->LoadResource(type, name, &size);
if (data && size) { if (data && size) {
item = new TypeItem(id, name, data, size); item = new TypeItem(id, name, data, size);
item->SetSourceIsFile(false); item->SetSourceIsFile(false);
@ -787,7 +806,7 @@ TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
{ {
if (!from) if (!from)
return NULL; return NULL;
TypeObject* obj = from->Object(); TypeObject* obj = from->Object();
BitmapTypeItem* bitmap = dynamic_cast<BitmapTypeItem*>(obj); BitmapTypeItem* bitmap = dynamic_cast<BitmapTypeItem*>(obj);
if (bitmap) if (bitmap)
@ -803,10 +822,11 @@ TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
// Try to read as an archived bitmap. // Try to read as an archived bitmap.
stream.Seek(0, SEEK_SET); stream.Seek(0, SEEK_SET);
BMessage archive; BMessage archive;
if (archive.Unflatten(&stream) == B_OK ) { if (archive.Unflatten(&stream) == B_OK) {
bitmap = new BitmapTypeItem(&archive); bitmap = new BitmapTypeItem(&archive);
if (bitmap && bitmap->InitCheck() != B_OK) { if (bitmap && bitmap->InitCheck() != B_OK) {
bitmap->Delete(); // allows us to delete this bitmap... bitmap->Delete();
// allows us to delete this bitmap...
delete bitmap; delete bitmap;
bitmap = NULL; bitmap = NULL;
} }
@ -815,11 +835,11 @@ TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
if (bitmap) { if (bitmap) {
BAutolock lock(&fLock); BAutolock lock(&fLock);
if (from->Object() != NULL) { if (from->Object() != NULL) {
// Whoops! Someone snuck in under us. // Whoops! Someone snuck in under us.
bitmap->Delete(); bitmap->Delete();
delete bitmap; delete bitmap;
bitmap = dynamic_cast<BitmapTypeItem*>(from->Object()); bitmap = dynamic_cast<BitmapTypeItem*>(from->Object());
} else } else
from->SetObject(bitmap); from->SetObject(bitmap);
} }
@ -832,33 +852,33 @@ TResourceSet::ReturnStringBlockItem(TypeItem* from)
{ {
if (!from) if (!from)
return NULL; return NULL;
TypeObject* obj = from->Object(); TypeObject* obj = from->Object();
StringBlockTypeItem* stringBlock = dynamic_cast<StringBlockTypeItem*>(obj); StringBlockTypeItem* stringBlock = dynamic_cast<StringBlockTypeItem*>(obj);
if (stringBlock) if (stringBlock)
return stringBlock; return stringBlock;
// Can't change an existing object. // Can't change an existing object.
if (obj) if (obj)
return NULL; return NULL;
// Don't have a string block in the item -- we'll create one. // Don't have a string block in the item -- we'll create one.
if (from->SourceIsFile() ) { if (from->SourceIsFile() ) {
BMemoryIO stream(from->Data(), from->Size()); BMemoryIO stream(from->Data(), from->Size());
stringBlock = new StringBlockTypeItem(&stream); stringBlock = new StringBlockTypeItem(&stream);
} else } else
stringBlock = new StringBlockTypeItem(from->Data(), from->Size()); stringBlock = new StringBlockTypeItem(from->Data(), from->Size());
if (stringBlock) { if (stringBlock) {
BAutolock lock(&fLock); BAutolock lock(&fLock);
if (from->Object() != NULL) { if (from->Object() != NULL) {
// Whoops! Someone snuck in under us. // Whoops! Someone snuck in under us.
delete stringBlock; delete stringBlock;
stringBlock = dynamic_cast<StringBlockTypeItem*>(from->Object()); stringBlock = dynamic_cast<StringBlockTypeItem*>(from->Object());
} else } else
from->SetObject(stringBlock); from->SetObject(stringBlock);
} }
return stringBlock; return stringBlock;
} }
@ -867,10 +887,8 @@ TResourceSet::ReturnStringBlockItem(TypeItem* from)
namespace TResourcePrivate { namespace TResourcePrivate {
TResourceSet* gResources = NULL; TResourceSet* gResources = NULL;
BLocker gResourceLocker; BLocker gResourceLocker;
} }
@ -880,7 +898,7 @@ AppResSet()
// If already have it, return immediately. // If already have it, return immediately.
if (gResources) if (gResources)
return gResources; return gResources;
// Don't have 'em, lock access to make 'em. // Don't have 'em, lock access to make 'em.
if (!gResourceLocker.Lock()) if (!gResourceLocker.Lock())
return NULL; return NULL;
@ -889,7 +907,7 @@ AppResSet()
gResourceLocker.Unlock(); gResourceLocker.Unlock();
return gResources; return gResources;
} }
// Make 'em. // Make 'em.
gResources = new TResourceSet; gResources = new TResourceSet;
gResources->AddResources(BApplication::AppResources()); gResources->AddResources(BApplication::AppResources());

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _T_RESOURCE_SET_H #ifndef _T_RESOURCE_SET_H
@ -57,14 +58,14 @@ public:
TStringBlock(BDataIO* data); TStringBlock(BDataIO* data);
TStringBlock(const void* block, size_t size); TStringBlock(const void* block, size_t size);
virtual ~TStringBlock(); virtual ~TStringBlock();
const char* String(size_t index) const; const char* String(size_t index) const;
private: private:
size_t PreIndex(char* strings, ssize_t len); size_t PreIndex(char* strings, ssize_t len);
void MakeIndex(const char* strings, ssize_t len, void MakeIndex(const char* strings, ssize_t len, size_t indexLen,
size_t indexLen, size_t* outIndex); size_t* outIndex);
size_t fNumEntries; size_t fNumEntries;
size_t* fIndex; size_t* fIndex;
char* fStrings; char* fStrings;
@ -80,34 +81,32 @@ public:
status_t AddDirectory(const char* fullPath); status_t AddDirectory(const char* fullPath);
status_t AddEnvDirectory(const char* envPath, status_t AddEnvDirectory(const char* envPath,
const char* defaultValue = NULL); const char* defaultValue = NULL);
const void* FindResource(type_code type, int32 id, const void* FindResource(type_code type, int32 id, size_t* outSize);
size_t* outSize); const void* FindResource(type_code type, const char* name, size_t* outSize);
const void* FindResource(type_code type, const char* name,
size_t* outSize);
const BBitmap* FindBitmap(type_code type, int32 id); const BBitmap* FindBitmap(type_code type, int32 id);
const BBitmap* FindBitmap(type_code type, const char* name); const BBitmap* FindBitmap(type_code type, const char* name);
const TStringBlock* FindStringBlock(type_code type, int32 id); const TStringBlock* FindStringBlock(type_code type, int32 id);
const TStringBlock* FindStringBlock(type_code type, const char* name); const TStringBlock* FindStringBlock(type_code type, const char* name);
const char* FindString(type_code type, int32 id, uint32 index); const char* FindString(type_code type, int32 id, uint32 index);
const char* FindString(type_code type, const char* name, uint32 index); const char* FindString(type_code type, const char* name, uint32 index);
private: private:
status_t ExpandString(BString* out, const char* in); status_t ExpandString(BString* out, const char* in);
TypeList* FindTypeList(type_code type); TypeList* FindTypeList(type_code type);
TypeItem* FindItemID(type_code type, int32 id); TypeItem* FindItemID(type_code type, int32 id);
TypeItem* FindItemName(type_code type, const char* name); TypeItem* FindItemName(type_code type, const char* name);
TypeItem* LoadResource(type_code type, int32 id, const char* name, TypeItem* LoadResource(type_code type, int32 id, const char* name,
TypeList** inoutList = NULL); TypeList** inoutList = NULL);
BBitmap* ReturnBitmapItem(type_code type, TypeItem* from); BBitmap* ReturnBitmapItem(type_code type, TypeItem* from);
TStringBlock* ReturnStringBlockItem(TypeItem* from); TStringBlock* ReturnStringBlockItem(TypeItem* from);
BLocker fLock; // access control. BLocker fLock; // access control.
BList fResources; // containing BResources objects. BList fResources; // containing BResources objects.
BList fDirectories; // containing BPath objects. BList fDirectories; // containing BPath objects.

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
@ -43,20 +44,20 @@ All rights reserved.
class TShowHideMenuItem : public BMenuItem { class TShowHideMenuItem : public BMenuItem {
public: public:
TShowHideMenuItem(const char* title, TShowHideMenuItem(const char* title,
const BList* teams, const BList* teams,
uint32 action); uint32 action);
static status_t TeamShowHideCommon(int32 action, static status_t TeamShowHideCommon(int32 action,
const BList* teamList, const BList* teamList,
BRect zoomRect = BRect(0, 0, 0, 0), BRect zoomRect = BRect(0, 0, 0, 0),
bool doZoom = false); bool doZoom = false);
protected: protected:
virtual void GetContentSize(float* width, float* height); virtual void GetContentSize(float* width, float* height);
virtual void DrawContent(); virtual void DrawContent();
virtual status_t Invoke(BMessage* message = NULL); virtual status_t Invoke(BMessage* message = NULL);
private: private:
const BList* fTeams; const BList* fTeams;
uint32 fAction; uint32 fAction;
float fTitleWidth; float fTitleWidth;

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
@ -74,19 +75,19 @@ All rights reserved.
using std::max; using std::max;
#ifdef DB_ADDONS #ifdef DB_ADDONS
// Add-on support // Add-on support
// //
// Item - internal item list (node, eref, etc) // Item - internal item list (node, eref, etc)
// Icon - physical replicant handed to the DeskbarClass class // Icon - physical replicant handed to the DeskbarClass class
// AddOn - attribute based add-on // AddOn - attribute based add-on
const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item"; const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item";
const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry"; const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry";
const char* const kDeskbarSecurityCodeFile = "Deskbar_security_code"; const char* const kDeskbarSecurityCodeFile = "Deskbar_security_code";
const char* const kDeskbarSecurityCodeAttr = "be:deskbar_security_code"; const char* const kDeskbarSecurityCodeAttr = "be:deskbar_security_code";
const char* const kStatusPredicate = "be:deskbar_item_status"; const char* const kStatusPredicate = "be:deskbar_item_status";
const char* const kEnabledPredicate = "be:deskbar_item_status=enabled"; const char* const kEnabledPredicate = "be:deskbar_item_status = enabled";
const char* const kDisabledPredicate = "be:deskbar_item_status=disabled"; const char* const kDisabledPredicate = "be:deskbar_item_status = disabled";
float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth; float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth;
@ -240,8 +241,7 @@ TReplicantTray::DealWithClock(bool showClock)
} }
/*! /*! Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth
Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth
if not in multirowmode and greater than kMinimumReplicantCount if not in multirowmode and greater than kMinimumReplicantCount
the width should be calculated based on the actual the width should be calculated based on the actual
replicant widths replicant widths
@ -255,17 +255,15 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
if (fShelf->CountReplicants() > 0) if (fShelf->CountReplicants() > 0)
height = fRightBottomReplicant.bottom; height = fRightBottomReplicant.bottom;
// the height will be uniform for the number of rows // the height will be uniform for the number of rows necessary to show
// necessary to show all the reps + any gutters // all the reps + any gutters necessary for spacing
// necessary for spacing
int32 rowCount = (int32)(height / kMaxReplicantHeight); int32 rowCount = (int32)(height / kMaxReplicantHeight);
height = kGutter + (rowCount * kMaxReplicantHeight) height = kGutter + (rowCount * kMaxReplicantHeight)
+ ((rowCount - 1) * kIconGap) + kGutter; + ((rowCount - 1) * kIconGap) + kGutter;
height = max(kMinimumTrayHeight, height); height = max(kMinimumTrayHeight, height);
width = fMinimumTrayWidth; width = fMinimumTrayWidth;
} else { } else {
// if last replicant overruns clock then // if last replicant overruns clock then resize to accomodate
// resize to accomodate
if (fShelf->CountReplicants() > 0) { if (fShelf->CountReplicants() > 0) {
if (fBarView->ShowingClock() if (fBarView->ShowingClock()
&& fRightBottomReplicant.right + 6 >= fClock->Frame().left) { && fRightBottomReplicant.right + 6 >= fClock->Frame().left) {
@ -274,12 +272,13 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
} else } else
width = fRightBottomReplicant.right + 3; width = fRightBottomReplicant.right + 3;
} }
// this view has a fixed minimum width // this view has a fixed minimum width
width = max(fMinimumTrayWidth, width); width = max(fMinimumTrayWidth, width);
} }
*preferredWidth = width; *preferredWidth = width;
// add 2 for the border // add 1 for the border
*preferredHeight = height + 1; *preferredHeight = height + 1;
} }
@ -350,8 +349,7 @@ TReplicantTray::ShowReplicantMenu(BPoint point)
BPopUpMenu* menu = new BPopUpMenu("", false, false); BPopUpMenu* menu = new BPopUpMenu("", false, false);
menu->SetFont(be_plain_font); menu->SetFont(be_plain_font);
// If the clock is visible, show the extended menu // If clock is visible show the extended menu, otherwise show "Show Time"
// otheriwse, show "Show Time".
if (fBarView->ShowingClock()) if (fBarView->ShowingClock())
fClock->ShowClockOptions(ConvertToScreen(point)); fClock->ShowClockOptions(ConvertToScreen(point));
@ -375,7 +373,7 @@ TReplicantTray::MouseDown(BPoint where)
DumpList(fItemList); DumpList(fItemList);
#endif #endif
uint32 buttons; uint32 buttons;
Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons); Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons);
if (buttons == B_SECONDARY_MOUSE_BUTTON) { if (buttons == B_SECONDARY_MOUSE_BUTTON) {
@ -412,15 +410,15 @@ TReplicantTray::InitAddOnSupport()
{ {
// list to maintain refs to each rep added/deleted // list to maintain refs to each rep added/deleted
fItemList = new BList(); fItemList = new BList();
bool haveKey = false; bool haveKey = false;
BPath path; BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
path.Append(kDeskbarSecurityCodeFile); path.Append(kDeskbarSecurityCodeFile);
BFile file(path.Path(),B_READ_ONLY); BFile file(path.Path(), B_READ_ONLY);
if (file.InitCheck() == B_OK if (file.InitCheck() == B_OK
&& file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode))
== sizeof(fDeskbarSecurityCode)) == sizeof(fDeskbarSecurityCode))
haveKey = true; haveKey = true;
} }
@ -443,8 +441,7 @@ TReplicantTray::InitAddOnSupport()
} }
} }
// for each volume currently mounted // for each volume currently mounted index the volume with our indices
// index the volume with our indices
BVolumeRoster roster; BVolumeRoster roster;
BVolume volume; BVolume volume;
while (roster.GetNextVolume(&volume) == B_OK) { while (roster.GetNextVolume(&volume) == B_OK) {
@ -488,8 +485,7 @@ TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate)
|| fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0) || fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0)
return; return;
// run a new query on a specific volume // run a new query on a specific volume and make it live
// make it live
BQuery query; BQuery query;
query.SetVolume(volume); query.SetVolume(volume);
query.SetPredicate(predicate); query.SetPredicate(predicate);
@ -557,7 +553,7 @@ TReplicantTray::NodeExists(node_ref& nodeRef)
} }
/*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received /*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received
for the registered add-ons. for the registered add-ons.
*/ */
void void
@ -697,8 +693,7 @@ TReplicantTray::HandleEntryUpdate(BMessage* message)
} }
/*! /*! The add-ons must support the exported C function API
The add-ons must support the exported C function API
if they do, they will be loaded and added to deskbar if they do, they will be loaded and added to deskbar
primary function is the Instantiate function primary function is the Instantiate function
*/ */
@ -883,7 +878,7 @@ TReplicantTray::MoveItem(entry_ref* ref, ino_t toDirectory)
} }
} }
#endif // add-on support #endif // add-on support
// external add-on API routines // external add-on API routines
// called using the new BDeskbar class // called using the new BDeskbar class
@ -989,7 +984,7 @@ TReplicantTray::IconCount() const
} }
/*! Message must contain an archivable view for later rehydration. /*! Message must contain an archivable view for later rehydration.
This function takes over ownership of the provided message on success This function takes over ownership of the provided message on success
only. only.
Returns the current replicant ID. Returns the current replicant ID.
@ -1008,6 +1003,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
ref = *addOn; ref = *addOn;
} else { } else {
const char* signature; const char* signature;
status_t status = archive->FindString("add_on", &signature); status_t status = archive->FindString("add_on", &signature);
if (status == B_OK) { if (status == B_OK) {
BRoster roster; BRoster roster;
@ -1028,10 +1024,9 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
return status; return status;
BEntry entry(&ref, true); BEntry entry(&ref, true);
// ToDo: this resolves an eventual link for the item // TODO: this resolves an eventual link for the item being added - this
// being added - this is okay for now, but in multi-user // is okay for now, but in multi-user environments, one might want to
// environments, one might want to have links that // have links that carry the be:deskbar_item_status attribute
// carry the be:deskbar_item_status attribute
status = entry.InitCheck(); status = entry.InitCheck();
if (status != B_OK) if (status != B_OK)
return status; return status;
@ -1041,10 +1036,10 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
archive->what = 0; archive->what = 0;
BRect originalBounds = archive->FindRect("_frame"); BRect originalBounds = archive->FindRect("_frame");
// this is a work-around for buggy replicants that change their // this is a work-around for buggy replicants that change their size in
// size in AttachedToWindow() (such as "SVM") // AttachedToWindow() (such as "SVM")
// !! check for name collisions? // TODO: check for name collisions?
status = fShelf->AddReplicant(archive, BPoint(1, 1)); status = fShelf->AddReplicant(archive, BPoint(1, 1));
if (status != B_OK) if (status != B_OK)
return status; return status;
@ -1070,7 +1065,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
// add the item to the add-on list // add the item to the add-on list
AddItem(*id, nodeRef, entry, addOn != NULL); AddItem(*id, nodeRef, entry, addOn != NULL);
return B_OK; return B_OK;
} }
@ -1129,8 +1124,7 @@ TReplicantTray::RealReplicantAdjustment(int32 startIndex)
float width, height; float width, height;
GetPreferredSize(&width, &height); GetPreferredSize(&width, &height);
if (oldWidth != width || oldHeight != height) { if (oldWidth != width || oldHeight != height) {
// resize view to accomodate the replicants // resize view to accomodate the replicants, redraw as necessary
// redraw as necessary
AdjustPlacement(); AdjustPlacement();
} }
} }
@ -1154,7 +1148,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
} }
} }
} else { } else {
int32 count = fShelf->CountReplicants()-1; int32 count = fShelf->CountReplicants() - 1;
int32 localid; int32 localid;
for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) { for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) {
fShelf->ReplicantAt(repIndex, &view, (uint32*)&localid); fShelf->ReplicantAt(repIndex, &view, (uint32*)&localid);
@ -1165,7 +1159,6 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
} }
} }
} }
return NULL; return NULL;
} }
@ -1189,7 +1182,6 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
return view; return view;
} }
} }
return NULL; return NULL;
} }
@ -1353,7 +1345,7 @@ TReplicantTray::SetMultiRow(bool state)
// #pragma mark - // #pragma mark -
/*! Draggable region that is asynchronous so that dragging does not block /*! Draggable region that is asynchronous so that dragging does not block
other activities. other activities.
*/ */
TDragRegion::TDragRegion(TBarView* parent, BView* child) TDragRegion::TDragRegion(TBarView* parent, BView* child)
@ -1583,16 +1575,16 @@ bool
TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect, TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect,
bool newVertical, bool newLeft, bool newTop, int32 newState) bool newVertical, bool newLeft, bool newTop, int32 newState)
{ {
if (!rect.Contains(mouse)) if (!rect.Contains(mouse)) {
// not our rect // not our rect
return false; return false;
}
if (newVertical == fBarView->Vertical() if (newVertical == fBarView->Vertical() && newLeft == fBarView->Left()
&& newLeft == fBarView->Left() && newTop == fBarView->Top() && newState == fBarView->State()) {
&& newTop == fBarView->Top()
&& newState == fBarView->State())
// already in the correct mode // already in the correct mode
return true; return true;
}
fBarView->ChangeState(newState, newVertical, newLeft, newTop); fBarView->ChangeState(newState, newVertical, newLeft, newTop);
return true; return true;

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
@ -51,12 +52,11 @@ const int32 kIconGap = 2;
const int32 kGutter = 1; const int32 kGutter = 1;
const int32 kDragRegionWidth = 6; const int32 kDragRegionWidth = 6;
// 1 pixel left gutter // 1 pixel left gutter
// space for replicant tray (6 items) // space for replicant tray (6 items)
// 6 pixel drag region // 6 pixel drag region
const float kMinimumTrayWidth = kIconGap const float kMinimumTrayWidth = kIconGap + (kMinimumReplicantCount * kIconGap)
+ (kMinimumReplicantCount * kIconGap) + (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
+ (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter; const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter;
extern float sMinimumWindowWidth; extern float sMinimumWindowWidth;
@ -104,7 +104,7 @@ public:
void RemoveIcon(int32 target, bool byIndex = false); void RemoveIcon(int32 target, bool byIndex = false);
void RemoveIcon(const char* name); void RemoveIcon(const char* name);
BRect IconFrame(int32 target, bool byIndex=false); BRect IconFrame(int32 target, bool byIndex = false);
BRect IconFrame(const char* name); BRect IconFrame(const char* name);
bool AcceptAddon(BRect frame, BMessage* message); bool AcceptAddon(BRect frame, BMessage* message);

View File

@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
@ -68,15 +69,16 @@ TReplicantShelf::MessageReceived(BMessage* message)
// since we can't use ReplicantDeleted // since we can't use ReplicantDeleted
// catch the message and find the id or name specifier // catch the message and find the id or name specifier
// then delete the rep vi the api, // then delete the rep vi the api,
//
// this will fix the problem of realigning the reps // this will fix the problem of realigning the reps
// after a remove when done through scripting // after a remove when done through scripting
//
// note: if specified by index its the index not the id! // note: if specified by index its the index not the id!
while (message->FindMessage("specifiers", index++, &repspec) while (message->FindMessage("specifiers", index++, &repspec)
== B_OK) { == B_OK) {
const char* str; const char* str;
if (repspec.FindString("property", &str) == B_OK) { if (repspec.FindString("property", &str) == B_OK) {
if (strcmp(str, "Replicant") == 0) { if (strcmp(str, "Replicant") == 0) {
int32 index; int32 index;
@ -103,7 +105,7 @@ TReplicantShelf::MessageReceived(BMessage* message)
} }
bool bool
TReplicantShelf::CanAcceptReplicantView(BRect frame, BView* view, TReplicantShelf::CanAcceptReplicantView(BRect frame, BView* view,
BMessage* message) const BMessage* message) const
{ {

View File

@ -26,14 +26,15 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries. Other
names are registered trademarks or trademarks of their respective holders. brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved. All rights reserved.
*/ */
// overrides BShelf; rejects draggers that won't fit into the shelf // overrides BShelf; rejects draggers that won't fit into the shelf
// alligns received draggers into a grid // alligns received draggers into a grid
#ifndef __STATUS_VIEW_SHELF__ #ifndef __STATUS_VIEW_SHELF__
#define __STATUS_VIEW_SHELF__ #define __STATUS_VIEW_SHELF__
@ -45,12 +46,12 @@ class TReplicantShelf : public BShelf {
public: public:
TReplicantShelf(TReplicantTray* view); TReplicantShelf(TReplicantTray* view);
~TReplicantShelf(); ~TReplicantShelf();
void MessageReceived(BMessage*); void MessageReceived(BMessage*);
protected: protected:
bool CanAcceptReplicantView(BRect, BView*, BMessage*) const; bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
BPoint AdjustReplicantBy(BRect, BMessage*) const; BPoint AdjustReplicantBy(BRect, BMessage*) const;
void ReplicantDeleted(int32, const BMessage*, const BView*); void ReplicantDeleted(int32, const BMessage*, const BView*);
private: private: