Deskbar: Rename some methods, variables, and call method

Rename IconCount() method to ReplicantCount()

Rename fChild and child to fReplicantTray and replicantTray
This commit is contained in:
John Scipione
2017-11-05 21:04:12 -08:00
parent c62a389196
commit 32b0035a9f
3 changed files with 21 additions and 20 deletions
+2 -1
View File
@@ -488,6 +488,7 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
} else { } else {
if (!fResizeControl->IsHidden()) if (!fResizeControl->IsHidden())
fResizeControl->Hide(); fResizeControl->Hide();
// move right and down to not cover border then resize to fit // move right and down to not cover border then resize to fit
fReplicantTray->MoveTo(kGutter, kGutter); fReplicantTray->MoveTo(kGutter, kGutter);
fReplicantTray->ResizeBy(-kGutter, -kGutter); fReplicantTray->ResizeBy(-kGutter, -kGutter);
@@ -1111,7 +1112,7 @@ TBarView::ItemExists(const char* name, DeskbarShelf)
int32 int32
TBarView::CountItems(DeskbarShelf) TBarView::CountItems(DeskbarShelf)
{ {
return fReplicantTray->IconCount(); return fReplicantTray->ReplicantCount();
} }
+15 -15
View File
@@ -215,7 +215,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
if (fMultiRowMode) { if (fMultiRowMode) {
width = static_cast<TBarApp*>(be_app)->Settings()->width width = static_cast<TBarApp*>(be_app)->Settings()->width
- kDragWidth - kGutter; - kDragWidth - kGutter;
if (fShelf->CountReplicants() > 0) if (ReplicantCount() > 0)
height = fRightBottomReplicant.bottom; height = fRightBottomReplicant.bottom;
// the height will be uniform for the number of rows necessary to show // the height will be uniform for the number of rows necessary to show
// all the reps + any gutters necessary for spacing // all the reps + any gutters necessary for spacing
@@ -225,7 +225,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
height = std::max(kMinimumTrayHeight, height); height = std::max(kMinimumTrayHeight, height);
} else { } else {
// if last replicant overruns clock then resize to accomodate // if last replicant overruns clock then resize to accomodate
if (fShelf->CountReplicants() > 0) { if (ReplicantCount() > 0) {
if (!fTime->IsHidden() if (!fTime->IsHidden()
&& fTime->Frame().left < fRightBottomReplicant.right + 12) { && fTime->Frame().left < fRightBottomReplicant.right + 12) {
width = fRightBottomReplicant.right + 12 width = fRightBottomReplicant.right + 12
@@ -889,7 +889,7 @@ TReplicantTray::IconExists(const char* name)
int32 int32
TReplicantTray::IconCount() const TReplicantTray::ReplicantCount() const
{ {
return fShelf->CountReplicants(); return fShelf->CountReplicants();
} }
@@ -955,7 +955,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
if (status != B_OK) if (status != B_OK)
return status; return status;
int32 count = fShelf->CountReplicants(); int32 count = ReplicantCount();
BView* view; BView* view;
fShelf->ReplicantAt(count - 1, &view, (uint32*)id, NULL); fShelf->ReplicantAt(count - 1, &view, (uint32*)id, NULL);
@@ -1062,7 +1062,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
} }
} }
} else { } else {
int32 count = fShelf->CountReplicants() - 1; int32 count = ReplicantCount() - 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);
@@ -1090,7 +1090,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
*id = -1; *id = -1;
BView* view; BView* view;
int32 count = fShelf->CountReplicants() - 1; int32 count = ReplicantCount() - 1;
for (int32 repIndex = count; repIndex >= 0; repIndex--) { for (int32 repIndex = count; repIndex >= 0; repIndex--) {
fShelf->ReplicantAt(repIndex, &view, (uint32*)id); fShelf->ReplicantAt(repIndex, &view, (uint32*)id);
if (view != NULL && view->Name() != NULL if (view != NULL && view->Name() != NULL
@@ -1132,7 +1132,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message)
else else
align = B_ALIGN_LEFT; align = B_ALIGN_LEFT;
BPoint loc = LocationForReplicant(fShelf->CountReplicants(), BPoint loc = LocationForReplicant(ReplicantCount(),
replicantFrame.Width()); replicantFrame.Width());
message->AddPoint("_pjp_loc", loc); message->AddPoint("_pjp_loc", loc);
@@ -1146,7 +1146,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message)
*/ */
BPoint BPoint
TReplicantTray::LocationForReplicant(int32 index, float width) TReplicantTray::LocationForReplicant(int32 index, float replicantWidth)
{ {
BPoint loc(kTrayPadding, 2); BPoint loc(kTrayPadding, 2);
if (fBarView->Vertical()) { if (fBarView->Vertical()) {
@@ -1243,8 +1243,8 @@ TReplicantTray::RealignReplicants(int32 startIndex)
if (startIndex < 0) if (startIndex < 0)
startIndex = 0; startIndex = 0;
int32 count = fShelf->CountReplicants(); int32 replicantCount = ReplicantCount();
if (count <= 0) if (replicantCount <= 0)
return; return;
if (startIndex == 0) if (startIndex == 0)
@@ -1298,12 +1298,12 @@ TReplicantTray::SaveTimeSettings()
/*! 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* replicantTray)
: :
BControl(BRect(0, 0, 0, 0), "", "", NULL, B_FOLLOW_NONE, BControl(BRect(0, 0, 0, 0), "", "", NULL, B_FOLLOW_NONE,
B_WILL_DRAW | B_FRAME_EVENTS), B_WILL_DRAW | B_FRAME_EVENTS),
fBarView(parent), fBarView(parent),
fChild(child), fReplicantTray(replicantTray),
fDragLocation(kAutoPlaceDragRegion) fDragLocation(kAutoPlaceDragRegion)
{ {
} }
@@ -1326,9 +1326,9 @@ TDragRegion::AttachedToWindow()
void void
TDragRegion::GetPreferredSize(float* width, float* height) TDragRegion::GetPreferredSize(float* width, float* height)
{ {
fChild->ResizeToPreferred(); fReplicantTray->ResizeToPreferred();
*width = fChild->Bounds().Width(); *width = fReplicantTray->Bounds().Width();
*height = fChild->Bounds().Height(); *height = fReplicantTray->Bounds().Height();
if (fDragLocation != kNoDragRegion) if (fDragLocation != kNoDragRegion)
*width += kDragWidth + kGutter; *width += kDragWidth + kGutter;
+4 -4
View File
@@ -107,7 +107,7 @@ public:
bool IconExists(int32 target, bool byIndex = false); bool IconExists(int32 target, bool byIndex = false);
bool IconExists(const char* name); bool IconExists(const char* name);
int32 IconCount() const; int32 ReplicantCount() const;
status_t AddIcon(BMessage*, int32* id, status_t AddIcon(BMessage*, int32* id,
const entry_ref* = NULL); const entry_ref* = NULL);
@@ -160,7 +160,7 @@ private:
#endif #endif
BPoint LocationForReplicant(int32 index, BPoint LocationForReplicant(int32 index,
float width); float replicantWidth);
BShelf* Shelf() const; BShelf* Shelf() const;
status_t _SaveSettings(); status_t _SaveSettings();
@@ -196,7 +196,7 @@ enum {
class TDragRegion : public BControl { class TDragRegion : public BControl {
public: public:
TDragRegion(TBarView* barView, BView* child); TDragRegion(TBarView* barView, BView* replicantTray);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void GetPreferredSize(float*, float*); virtual void GetPreferredSize(float*, float*);
@@ -218,7 +218,7 @@ public:
private: private:
TBarView* fBarView; TBarView* fBarView;
BView* fChild; BView* fReplicantTray;
BPoint fPreviousPosition; BPoint fPreviousPosition;
int32 fDragLocation; int32 fDragLocation;
}; };