Author: tqh Date: 2011-03-06 16:57:48 +0100 (Sun, 06 Mar 2011) New Revision: 40847 Changeset: http://dev.haiku-os.org/changeset/40847 Ticket: http://dev.haiku-os.org/ticket/7052 Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp haiku/trunk/src/apps/deskbar/PreferencesWindow.h haiku/trunk/src/apps/deskbar/ResourceSet.cpp haiku/trunk/src/apps/deskbar/ResourceSet.h haiku/trunk/src/apps/deskbar/ShowHideMenuItem.cpp haiku/trunk/src/apps/deskbar/ShowHideMenuItem.h haiku/trunk/src/apps/deskbar/StatusView.cpp haiku/trunk/src/apps/deskbar/StatusView.h haiku/trunk/src/apps/deskbar/StatusViewShelf.cpp haiku/trunk/src/apps/deskbar/StatusViewShelf.h Log: More style cleanup patches from John Scipione as part of #7052. Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp 2011-03-06 15:57:48 UTC (rev 40847) @@ -35,8 +35,7 @@ // Controls fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"), new BMessage(kUpdateRecentCounts)); - fMenuRecentApplications = new BCheckBox( - B_TRANSLATE("Recent applications:"), + fMenuRecentApplications = new BCheckBox(B_TRANSLATE("Recent applications:"), new BMessage(kUpdateRecentCounts)); fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"), new BMessage(kUpdateRecentCounts)); @@ -52,8 +51,7 @@ new BMessage(kSortRunningApps)); fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"), new BMessage(kTrackerFirst)); - fAppsShowExpanders = new BCheckBox( - B_TRANSLATE("Show application expander"), + fAppsShowExpanders = new BCheckBox(B_TRANSLATE("Show application expander"), new BMessage(kSuperExpando)); fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), new BMessage(kExpandNewTeams)); @@ -83,7 +81,7 @@ // Values TBarApp* barApp = static_cast<TBarApp*>(be_app); - desk_settings* appSettings = barApp->Settings();; + desk_settings* appSettings = barApp->Settings(); fAppsSort->SetValue(appSettings->sortRunningApps); fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.h =================================================================== --- haiku/trunk/src/apps/deskbar/PreferencesWindow.h 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/PreferencesWindow.h 2011-03-06 15:57:48 UTC (rev 40847) @@ -28,8 +28,8 @@ PreferencesWindow(BRect frame); ~PreferencesWindow(); - virtual void MessageReceived(BMessage* message); - virtual void WindowActivated(bool active); + virtual void MessageReceived(BMessage* message); + virtual void WindowActivated(bool active); private: void _UpdateRecentCounts(); Modified: haiku/trunk/src/apps/deskbar/ResourceSet.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/ResourceSet.cpp 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/ResourceSet.cpp 2011-03-06 15:57:48 UTC (rev 40847) @@ -26,9 +26,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Be Incorporated. -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered +trademarks of Be Incorporated in the United States and other countries. Other +brand product names are registered trademarks or trademarks of their respective +holders. All rights reserved. */ @@ -70,78 +71,78 @@ : fDeleteOK(false) { } - + virtual ~TypeObject() { if (!fDeleteOK) debugger("deleting object owned by BResourceSet"); } - + void Delete() { fDeleteOK = true; } - + private: TypeObject(const TypeObject &); TypeObject &operator=(const TypeObject &); bool operator==(const TypeObject &); bool operator!=(const TypeObject &); - + bool fDeleteOK; }; - + class BitmapTypeItem : public BBitmap, public TypeObject { public: 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) : BBitmap(bounds, flags, depth, bytesPerRow, screenID) { } - + BitmapTypeItem(const BBitmap* source, bool accepts_views = false, bool need_contiguous = false) : BBitmap(source, accepts_views, need_contiguous) { } - + BitmapTypeItem(BMessage* data) : BBitmap(data) { } - + virtual ~BitmapTypeItem() { } }; - + class StringBlockTypeItem : public TStringBlock, public TypeObject { public: StringBlockTypeItem(BDataIO* data) : TStringBlock(data) { } - + StringBlockTypeItem(const void* block, size_t size) : TStringBlock(block, size) { } - + virtual ~StringBlockTypeItem() { } }; - + class TypeItem { public: TypeItem(int32 id, const char* name, const void* data, size_t size) - : fID(id), fName(name), - fData(const_cast<void*>(data)), fSize(size), fObject(0), - fOwnData(false), fSourceIsFile(false) + : fID(id), fName(name), + fData(const_cast<void*>(data)), fSize(size), fObject(0), + fOwnData(false), fSourceIsFile(false) { } - + TypeItem(int32 id, const char* name, BFile* file) : fID(id), fName(name), @@ -162,7 +163,7 @@ } } } - + virtual ~TypeItem() { if (fOwnData) { @@ -172,19 +173,27 @@ } SetObject(NULL); } - + int32 ID() const - { return fID; } + { + return fID; + } const char* Name() const - { return fName.String(); } + { + return fName.String(); + } const void* Data() const - { return fData; } + { + return fData; + } size_t Size() const - { return fSize; } - + { + return fSize; + } + void SetObject(TypeObject* object) { if (object == fObject) @@ -195,14 +204,20 @@ } TypeObject* Object() const - { return fObject; } - + { + return fObject; + } + void SetSourceIsFile(bool state) - { fSourceIsFile = state; } + { + fSourceIsFile = state; + } bool SourceIsFile() const - { return fSourceIsFile; } - + { + return fSourceIsFile; + } + private: int32 fID; BString fName; @@ -212,7 +227,7 @@ bool fOwnData; bool fSourceIsFile; }; - + static bool FreeTypeItemFunc(void* item) { delete reinterpret_cast<TypeItem*>(item); @@ -225,16 +240,18 @@ : fType(type) { } - + virtual ~TypeList() { fItems.DoForEach(FreeTypeItemFunc); fItems.MakeEmpty(); } - + type_code Type() const - { return fType; } - + { + return fType; + } + TypeItem* FindItemByID(int32 id) { for (int32 i = 0; i < fItems.CountItems(); i++ ) { @@ -254,17 +271,16 @@ } return NULL; } - + void AddItem(TypeItem* item) { fItems.AddItem(item); } - + private: type_code fType; BList fItems; }; - } using namespace TResourcePrivate; @@ -282,13 +298,13 @@ fStrings = (char*)malloc(1024); size_t pos = 0; ssize_t amount; - while ((amount=data->Read(fStrings + pos, 1024)) == 1024) { + while ((amount = data->Read(fStrings + pos, 1024)) == 1024) { pos += amount; fStrings = (char*)realloc(fStrings, pos + 1024); } if (amount > 0) pos += amount; - + fNumEntries = PreIndex(fStrings, amount); fIndex = (size_t*)malloc(sizeof(size_t) * fNumEntries); MakeIndex(fStrings, amount, fNumEntries, fIndex); @@ -304,7 +320,7 @@ { fIndex = (size_t*)const_cast<void*>(block); fStrings = (char*)const_cast<void*>(block); - + // Figure out how many entries there are. size_t last_off = 0; while (fIndex[fNumEntries] > last_off && fIndex[fNumEntries] < size ) { @@ -339,12 +355,12 @@ TStringBlock::PreIndex(char* strings, ssize_t len) { size_t count = 0; - char* orig = strings; char* end = strings + len; bool in_cr = false; bool first = true; bool skipping = false; + while (orig < end) { if (*orig == '\n' || *orig == '\r' || *orig == 0) { if (!in_cr && *orig == '\r') @@ -371,30 +387,29 @@ case '\\': *strings = '\\'; break; - + case '\n': *strings = '\n'; break; - + case '\r': *strings = '\r'; break; - + case '\t': *strings = '\t'; break; - + default: *strings = *orig; break; } - } else + } else *strings = *orig; orig++; strings++; } - return count; } @@ -405,7 +420,7 @@ { *resultingIndex++ = 0; indexLength--; - + ssize_t pos = 0; while (pos < len && indexLength > 0) { if (strings[pos] == 0 ) { @@ -475,7 +490,7 @@ #if USE_RESOURCES if (!resources) return B_BAD_VALUE; - + BAutolock lock(&fLock); status_t err = fResources.AddItem(resources) ? B_OK : B_ERROR; if (err != B_OK) @@ -499,7 +514,7 @@ delete path; return err; } - + BAutolock lock(&fLock); err = fDirectories.AddItem(path) ? B_OK : B_ERROR; if (err != B_OK) @@ -514,13 +529,13 @@ { BString buf; status_t err = ExpandString(&buf, in); - + if (err != B_OK) { if (defaultValue) return AddDirectory(defaultValue); return err; } - + return AddDirectory(buf.String()); } @@ -529,11 +544,12 @@ TResourceSet::ExpandString(BString* out, const char* in) { const char* start = in; + while (*in) { if (*in == '$') { if (start < in) - out->Append(start, (int32)(in - start)); - + out->Append(start, (int32)(in - start)); + in++; char variableName[1024]; size_t i = 0; @@ -545,25 +561,25 @@ if (*in) in++; - } else - while ((isalnum(*in) || *in == '_') && i - < sizeof(variableName) - 1) + } else { + while ((isalnum(*in) || *in == '_') + && i < sizeof(variableName) - 1) variableName[i++] = *in++; - + } + start = in; - variableName[i] = '\0'; - + const char* val = getenv(variableName); if (!val) { PRINT(("Error: env var %s not found.\n", &variableName[0])); return B_NAME_NOT_FOUND; } - + status_t err = ExpandString(out, val); if (err != B_OK) return err; - + } else if (*in == '\\') { if (start < in) out->Append(start, (int32)(in - start)); @@ -576,7 +592,7 @@ if (start < in) out->Append(start, (int32)(in - start)); - + return B_OK; } @@ -585,7 +601,7 @@ TResourceSet::FindResource(type_code type, int32 id, size_t* outSize) { TypeItem* item = FindItemID(type, id); - + if (outSize) *outSize = item ? item->Size() : 0; @@ -597,7 +613,7 @@ TResourceSet::FindResource(type_code type, const char* name, size_t* outSize) { TypeItem* item = FindItemName(type, name); - + if (outSize) *outSize = item ? item->Size() : 0; @@ -632,11 +648,12 @@ return ReturnStringBlockItem(FindItemName(type, name)); } - + const char* TResourceSet::FindString(type_code type, int32 id, uint32 index) { const TStringBlock* stringBlock = FindStringBlock(type, id); + if (!stringBlock) return NULL; @@ -648,25 +665,26 @@ TResourceSet::FindString(type_code type, const char* name, uint32 index) { const TStringBlock* stringBlock = FindStringBlock(type, name); + if (!stringBlock) return NULL; return stringBlock->String(index); } - + TypeList* TResourceSet::FindTypeList(type_code type) { BAutolock lock(&fLock); - + int32 count = fTypes.CountItems(); for (int32 i = 0; i < count; i++ ) { TypeList* list = (TypeList*)fTypes.ItemAt(i); if (list && list->Type() == type) return list; } - + return NULL; } @@ -676,12 +694,13 @@ { TypeList* list = FindTypeList(type); TypeItem* item = NULL; - - if (list) item = list->FindItemByID(id); - + + if (list) + item = list->FindItemByID(id); + if (!item) item = LoadResource(type, id, 0, &list); - + return item; } @@ -691,13 +710,13 @@ { TypeList* list = FindTypeList(type); TypeItem* item = NULL; - + if (list) item = list->FindItemByName(name); - + if (!item) item = LoadResource(type, -1, name, &list); - + return item; } @@ -707,10 +726,10 @@ TypeList** inOutList) { TypeItem* item = NULL; - + if (name) { BEntry entry; - + // If a named resource, first look in directories. fLock.Lock(); int32 count = fDirectories.CountItems(); @@ -731,7 +750,7 @@ } fLock.Unlock(); } - + #if USE_RESOURCES if (!item) { // Look through resource objects for data. @@ -746,7 +765,7 @@ data = resource->LoadResource(type, id, &size); else if (name != NULL) data = resource->LoadResource(type, name, &size); - + if (data && size) { item = new TypeItem(id, name, data, size); item->SetSourceIsFile(false); @@ -787,7 +806,7 @@ { if (!from) return NULL; - + TypeObject* obj = from->Object(); BitmapTypeItem* bitmap = dynamic_cast<BitmapTypeItem*>(obj); if (bitmap) @@ -803,10 +822,11 @@ // Try to read as an archived bitmap. stream.Seek(0, SEEK_SET); BMessage archive; - if (archive.Unflatten(&stream) == B_OK ) { + if (archive.Unflatten(&stream) == B_OK) { bitmap = new BitmapTypeItem(&archive); if (bitmap && bitmap->InitCheck() != B_OK) { - bitmap->Delete(); // allows us to delete this bitmap... + bitmap->Delete(); + // allows us to delete this bitmap... delete bitmap; bitmap = NULL; } @@ -815,11 +835,11 @@ if (bitmap) { BAutolock lock(&fLock); if (from->Object() != NULL) { - // Whoops! Someone snuck in under us. + // Whoops! Someone snuck in under us. bitmap->Delete(); delete bitmap; bitmap = dynamic_cast<BitmapTypeItem*>(from->Object()); - } else + } else from->SetObject(bitmap); } @@ -832,33 +852,33 @@ { if (!from) return NULL; - + TypeObject* obj = from->Object(); StringBlockTypeItem* stringBlock = dynamic_cast<StringBlockTypeItem*>(obj); if (stringBlock) return stringBlock; - + // Can't change an existing object. if (obj) return NULL; - + // Don't have a string block in the item -- we'll create one. if (from->SourceIsFile() ) { BMemoryIO stream(from->Data(), from->Size()); stringBlock = new StringBlockTypeItem(&stream); } else stringBlock = new StringBlockTypeItem(from->Data(), from->Size()); - + if (stringBlock) { BAutolock lock(&fLock); if (from->Object() != NULL) { - // Whoops! Someone snuck in under us. + // Whoops! Someone snuck in under us. delete stringBlock; stringBlock = dynamic_cast<StringBlockTypeItem*>(from->Object()); } else from->SetObject(stringBlock); } - + return stringBlock; } @@ -867,10 +887,8 @@ namespace TResourcePrivate { - TResourceSet* gResources = NULL; BLocker gResourceLocker; - } @@ -880,7 +898,7 @@ // If already have it, return immediately. if (gResources) return gResources; - + // Don't have 'em, lock access to make 'em. if (!gResourceLocker.Lock()) return NULL; @@ -889,7 +907,7 @@ gResourceLocker.Unlock(); return gResources; } - + // Make 'em. gResources = new TResourceSet; gResources->AddResources(BApplication::AppResources()); Modified: haiku/trunk/src/apps/deskbar/ResourceSet.h =================================================================== --- haiku/trunk/src/apps/deskbar/ResourceSet.h 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/ResourceSet.h 2011-03-06 15:57:48 UTC (rev 40847) @@ -26,9 +26,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Be Incorporated. -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered +trademarks of Be Incorporated in the United States and other countries. Other +brand product names are registered trademarks or trademarks of their respective +holders. All rights reserved. */ #ifndef _T_RESOURCE_SET_H @@ -57,14 +58,14 @@ TStringBlock(BDataIO* data); TStringBlock(const void* block, size_t size); virtual ~TStringBlock(); - + const char* String(size_t index) const; private: size_t PreIndex(char* strings, ssize_t len); - void MakeIndex(const char* strings, ssize_t len, - size_t indexLen, size_t* outIndex); - + void MakeIndex(const char* strings, ssize_t len, size_t indexLen, + size_t* outIndex); + size_t fNumEntries; size_t* fIndex; char* fStrings; @@ -80,34 +81,32 @@ status_t AddDirectory(const char* fullPath); status_t AddEnvDirectory(const char* envPath, const char* defaultValue = NULL); - - const void* FindResource(type_code type, int32 id, - size_t* outSize); - const void* FindResource(type_code type, const char* name, - size_t* outSize); - + + const void* FindResource(type_code type, int32 id, 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, const char* name); - + const TStringBlock* FindStringBlock(type_code type, int32 id); 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, const char* name, uint32 index); - + private: status_t ExpandString(BString* out, const char* in); TypeList* FindTypeList(type_code type); - + TypeItem* FindItemID(type_code type, int32 id); TypeItem* FindItemName(type_code type, const char* name); - + TypeItem* LoadResource(type_code type, int32 id, const char* name, TypeList** inoutList = NULL); - + BBitmap* ReturnBitmapItem(type_code type, TypeItem* from); TStringBlock* ReturnStringBlockItem(TypeItem* from); - + BLocker fLock; // access control. BList fResources; // containing BResources objects. BList fDirectories; // containing BPath objects. Modified: haiku/trunk/src/apps/deskbar/ShowHideMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/ShowHideMenuItem.cpp 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/ShowHideMenuItem.cpp 2011-03-06 15:57:48 UTC (rev 40847) @@ -26,9 +26,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Be Incorporated. -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered +trademarks of Be Incorporated in the United States and other countries. Other +brand product names are registered trademarks or trademarks of their respective +holders. All rights reserved. */ Modified: haiku/trunk/src/apps/deskbar/ShowHideMenuItem.h =================================================================== --- haiku/trunk/src/apps/deskbar/ShowHideMenuItem.h 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/ShowHideMenuItem.h 2011-03-06 15:57:48 UTC (rev 40847) @@ -26,9 +26,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Be Incorporated. -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered +trademarks of Be Incorporated in the United States and other countries. Other +brand product names are registered trademarks or trademarks of their respective +holders. All rights reserved. */ @@ -43,20 +44,20 @@ class TShowHideMenuItem : public BMenuItem { public: - TShowHideMenuItem(const char* title, + TShowHideMenuItem(const char* title, const BList* teams, uint32 action); - static status_t TeamShowHideCommon(int32 action, - const BList* teamList, - BRect zoomRect = BRect(0, 0, 0, 0), + static status_t TeamShowHideCommon(int32 action, + const BList* teamList, + BRect zoomRect = BRect(0, 0, 0, 0), bool doZoom = false); protected: virtual void GetContentSize(float* width, float* height); virtual void DrawContent(); virtual status_t Invoke(BMessage* message = NULL); -private: +private: const BList* fTeams; uint32 fAction; float fTitleWidth; Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/StatusView.cpp 2011-03-06 15:54:37 UTC (rev 40846) +++ haiku/trunk/src/apps/deskbar/StatusView.cpp 2011-03-06 15:57:48 UTC (rev 40847) @@ -26,9 +26,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Be Incorporated. -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered +trademarks of Be Incorporated in the United States and other countries. Other +brand product names are registered trademarks or trademarks of their respective +holders. All rights reserved. */ @@ -74,19 +75,19 @@ using std::max; #ifdef DB_ADDONS -// Add-on support +// Add-on support // -// Item - internal item list (node, eref, etc) -// Icon - physical replicant handed to the DeskbarClass class -// AddOn - attribute based add-on +// Item - internal item list (node, eref, etc) +// Icon - physical replicant handed to the DeskbarClass class +// AddOn - attribute based add-on const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item"; const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry"; const char* const kDeskbarSecurityCodeFile = "Deskbar_security_code"; const char* const kDeskbarSecurityCodeAttr = "be:deskbar_security_code"; const char* const kStatusPredicate = "be:deskbar_item_status"; -const char* const kEnabledPredicate = "be:deskbar_item_status=enabled"; -const char* const kDisabledPredicate = "be:deskbar_item_status=disabled"; +const char* const kEnabledPredicate = "be:deskbar_item_status = enabled"; +const char* const kDisabledPredicate = "be:deskbar_item_status = disabled"; float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth; @@ -240,8 +241,7 @@ } -/*! - 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 the width should be calculated based on the actual replicant widths @@ -255,17 +255,15 @@ if (fShelf->CountReplicants() > 0) height = fRightBottomReplicant.bottom; - // the height will be uniform for the number of rows - // necessary to show all the reps + any gutters - // necessary for spacing + // the height will be uniform for the number of rows necessary to show + // all the reps + any gutters necessary for spacing int32 rowCount = (int32)(height / kMaxReplicantHeight); height = kGutter + (rowCount * kMaxReplicantHeight) + ((rowCount - 1) * kIconGap) + kGutter; height = max(kMinimumTrayHeight, height); width = fMinimumTrayWidth; } else { - // if last replicant overruns clock then - // resize to accomodate + // if last replicant overruns clock then resize to accomodate if (fShelf->CountReplicants() > 0) { if (fBarView->ShowingClock() && fRightBottomReplicant.right + 6 >= fClock->Frame().left) { @@ -274,12 +272,13 @@ } else width = fRightBottomReplicant.right + 3; } + // this view has a fixed minimum width width = max(fMinimumTrayWidth, width); } *preferredWidth = width; - // add 2 for the border + // add 1 for the border *preferredHeight = height + 1; } @@ -350,8 +349,7 @@ BPopUpMenu* menu = new BPopUpMenu("", false, false); menu->SetFont(be_plain_font); - // If the clock is visible, show the extended menu - // otheriwse, show "Show Time". + // If clock is visible show the extended menu, otherwise show "Show Time" if (fBarView->ShowingClock()) fClock->ShowClockOptions(ConvertToScreen(point)); @@ -375,7 +373,7 @@ DumpList(fItemList); #endif - uint32 buttons; + uint32 buttons; Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons); if (buttons == B_SECONDARY_MOUSE_BUTTON) { @@ -412,15 +410,15 @@ { // list to maintain refs to each rep added/deleted fItemList = new BList(); - bool haveKey = false; - BPath path; + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { path.Append(kDeskbarSecurityCodeFile); - BFile file(path.Path(),B_READ_ONLY); + BFile file(path.Path(), B_READ_ONLY); if (file.InitCheck() == B_OK - && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) + && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) == sizeof(fDeskbarSecurityCode)) haveKey = true; } @@ -443,8 +441,7 @@ } } - // for each volume currently mounted - // index the volume with our indices + // for each volume currently mounted index the volume with our indices BVolumeRoster roster; BVolume volume; while (roster.GetNextVolume(&volume) == B_OK) { @@ -488,8 +485,7 @@ || fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0) return; - // run a new query on a specific volume - // make it live + // run a new query on a specific volume and make it live BQuery query; query.SetVolume(volume); query.SetPredicate(predicate); @@ -557,7 +553,7 @@ } -/*! 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. [... truncated: 277 lines follow ...]