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
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 @@ PreferencesWindow::PreferencesWindow(BRect frame)
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 @@ PreferencesWindow::PreferencesWindow(BRect frame)
// 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);

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
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.
*/
@ -174,16 +175,24 @@ namespace TResourcePrivate {
}
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)
{
@ -195,13 +204,19 @@ namespace TResourcePrivate {
}
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;
@ -233,7 +248,9 @@ namespace TResourcePrivate {
}
type_code Type() const
{ return fType; }
{
return fType;
}
TypeItem* FindItemByID(int32 id)
{
@ -264,7 +281,6 @@ namespace TResourcePrivate {
type_code fType;
BList fItems;
};
}
using namespace TResourcePrivate;
@ -339,12 +355,12 @@ size_t
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')
@ -394,7 +410,6 @@ TStringBlock::PreIndex(char* strings, ssize_t len)
orig++;
strings++;
}
return count;
}
@ -529,6 +544,7 @@ status_t
TResourceSet::ExpandString(BString* out, const char* in)
{
const char* start = in;
while (*in) {
if (*in == '$') {
if (start < in)
@ -545,13 +561,13 @@ TResourceSet::ExpandString(BString* out, const char* in)
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);
@ -637,6 +653,7 @@ const char*
TResourceSet::FindString(type_code type, int32 id, uint32 index)
{
const TStringBlock* stringBlock = FindStringBlock(type, id);
if (!stringBlock)
return NULL;
@ -648,6 +665,7 @@ const char*
TResourceSet::FindString(type_code type, const char* name, uint32 index)
{
const TStringBlock* stringBlock = FindStringBlock(type, name);
if (!stringBlock)
return NULL;
@ -677,7 +695,8 @@ TResourceSet::FindItemID(type_code type, int32 id)
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);
@ -806,7 +825,8 @@ TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
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;
}
@ -867,10 +887,8 @@ TResourceSet::ReturnStringBlockItem(TypeItem* from)
namespace TResourcePrivate {
TResourceSet* gResources = NULL;
BLocker gResourceLocker;
}

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
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
@ -62,8 +63,8 @@ public:
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;
@ -81,10 +82,8 @@ public:
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);

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
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.
*/

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
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.
*/

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
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.
*/
@ -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
the width should be calculated based on the actual
replicant widths
@ -255,17 +255,15 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
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 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
} 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 @@ TReplicantTray::ShowReplicantMenu(BPoint point)
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));
@ -412,9 +410,9 @@ TReplicantTray::InitAddOnSupport()
{
// list to maintain refs to each rep added/deleted
fItemList = new BList();
bool haveKey = false;
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
path.Append(kDeskbarSecurityCodeFile);
@ -443,8 +441,7 @@ TReplicantTray::InitAddOnSupport()
}
}
// 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 @@ TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate)
|| 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);
@ -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
primary function is the Instantiate function
*/
@ -1008,6 +1003,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
ref = *addOn;
} else {
const char* signature;
status_t status = archive->FindString("add_on", &signature);
if (status == B_OK) {
BRoster roster;
@ -1028,10 +1024,9 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
return status;
BEntry entry(&ref, true);
// ToDo: this resolves an eventual link for the item
// being added - this is okay for now, but in multi-user
// environments, one might want to have links that
// carry the be:deskbar_item_status attribute
// TODO: this resolves an eventual link for the item being added - this
// is okay for now, but in multi-user environments, one might want to
// have links that carry the be:deskbar_item_status attribute
status = entry.InitCheck();
if (status != B_OK)
return status;
@ -1041,10 +1036,10 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
archive->what = 0;
BRect originalBounds = archive->FindRect("_frame");
// this is a work-around for buggy replicants that change their
// size in AttachedToWindow() (such as "SVM")
// this is a work-around for buggy replicants that change their size in
// AttachedToWindow() (such as "SVM")
// !! check for name collisions?
// TODO: check for name collisions?
status = fShelf->AddReplicant(archive, BPoint(1, 1));
if (status != B_OK)
return status;
@ -1129,8 +1124,7 @@ TReplicantTray::RealReplicantAdjustment(int32 startIndex)
float width, height;
GetPreferredSize(&width, &height);
if (oldWidth != width || oldHeight != height) {
// resize view to accomodate the replicants
// redraw as necessary
// resize view to accomodate the replicants, redraw as necessary
AdjustPlacement();
}
}
@ -1165,7 +1159,6 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
}
}
}
return NULL;
}
@ -1189,7 +1182,6 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
return view;
}
}
return NULL;
}
@ -1583,16 +1575,16 @@ bool
TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect,
bool newVertical, bool newLeft, bool newTop, int32 newState)
{
if (!rect.Contains(mouse))
if (!rect.Contains(mouse)) {
// not our rect
return false;
}
if (newVertical == fBarView->Vertical()
&& newLeft == fBarView->Left()
&& newTop == fBarView->Top()
&& newState == fBarView->State())
if (newVertical == fBarView->Vertical() && newLeft == fBarView->Left()
&& newTop == fBarView->Top() && newState == fBarView->State()) {
// already in the correct mode
return true;
}
fBarView->ChangeState(newState, newVertical, newLeft, newTop);
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
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.
*/
@ -54,8 +55,7 @@ const int32 kDragRegionWidth = 6;
// 1 pixel left gutter
// space for replicant tray (6 items)
// 6 pixel drag region
const float kMinimumTrayWidth = kIconGap
+ (kMinimumReplicantCount * kIconGap)
const float kMinimumTrayWidth = kIconGap + (kMinimumReplicantCount * kIconGap)
+ (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter;

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
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.
*/
@ -68,15 +69,16 @@ TReplicantShelf::MessageReceived(BMessage* message)
// since we can't use ReplicantDeleted
// catch the message and find the id or name specifier
// then delete the rep vi the api,
//
// this will fix the problem of realigning the reps
// after a remove when done through scripting
//
// note: if specified by index its the index not the id!
while (message->FindMessage("specifiers", index++, &repspec)
== B_OK) {
const char* str;
if (repspec.FindString("property", &str) == B_OK) {
if (strcmp(str, "Replicant") == 0) {
int32 index;

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
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.
*/