From 32b0035a9ffedb1d062be485307b84ff0e83b885 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 23 Oct 2017 20:55:52 -0700 Subject: [PATCH] Deskbar: Rename some methods, variables, and call method Rename IconCount() method to ReplicantCount() Rename fChild and child to fReplicantTray and replicantTray --- src/apps/deskbar/BarView.cpp | 3 ++- src/apps/deskbar/StatusView.cpp | 30 +++++++++++++++--------------- src/apps/deskbar/StatusView.h | 8 ++++---- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 3fb1b8493a..9f46a53e61 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -488,6 +488,7 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap) } else { if (!fResizeControl->IsHidden()) fResizeControl->Hide(); + // move right and down to not cover border then resize to fit fReplicantTray->MoveTo(kGutter, kGutter); fReplicantTray->ResizeBy(-kGutter, -kGutter); @@ -1111,7 +1112,7 @@ TBarView::ItemExists(const char* name, DeskbarShelf) int32 TBarView::CountItems(DeskbarShelf) { - return fReplicantTray->IconCount(); + return fReplicantTray->ReplicantCount(); } diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 7321ac6475..7943f5a3cb 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -215,7 +215,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) if (fMultiRowMode) { width = static_cast(be_app)->Settings()->width - kDragWidth - kGutter; - if (fShelf->CountReplicants() > 0) + if (ReplicantCount() > 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 @@ -225,7 +225,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) height = std::max(kMinimumTrayHeight, height); } else { // if last replicant overruns clock then resize to accomodate - if (fShelf->CountReplicants() > 0) { + if (ReplicantCount() > 0) { if (!fTime->IsHidden() && fTime->Frame().left < fRightBottomReplicant.right + 12) { width = fRightBottomReplicant.right + 12 @@ -889,7 +889,7 @@ TReplicantTray::IconExists(const char* name) int32 -TReplicantTray::IconCount() const +TReplicantTray::ReplicantCount() const { return fShelf->CountReplicants(); } @@ -955,7 +955,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn) if (status != B_OK) return status; - int32 count = fShelf->CountReplicants(); + int32 count = ReplicantCount(); BView* view; fShelf->ReplicantAt(count - 1, &view, (uint32*)id, NULL); @@ -1062,7 +1062,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex) } } } else { - int32 count = fShelf->CountReplicants() - 1; + int32 count = ReplicantCount() - 1; int32 localid; for (int32 repIndex = count; repIndex >= 0; repIndex--) { fShelf->ReplicantAt(repIndex, &view, (uint32*)&localid); @@ -1090,7 +1090,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name) *id = -1; BView* view; - int32 count = fShelf->CountReplicants() - 1; + int32 count = ReplicantCount() - 1; for (int32 repIndex = count; repIndex >= 0; repIndex--) { fShelf->ReplicantAt(repIndex, &view, (uint32*)id); if (view != NULL && view->Name() != NULL @@ -1132,7 +1132,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message) else align = B_ALIGN_LEFT; - BPoint loc = LocationForReplicant(fShelf->CountReplicants(), + BPoint loc = LocationForReplicant(ReplicantCount(), replicantFrame.Width()); message->AddPoint("_pjp_loc", loc); @@ -1146,7 +1146,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message) */ BPoint -TReplicantTray::LocationForReplicant(int32 index, float width) +TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) { BPoint loc(kTrayPadding, 2); if (fBarView->Vertical()) { @@ -1243,8 +1243,8 @@ TReplicantTray::RealignReplicants(int32 startIndex) if (startIndex < 0) startIndex = 0; - int32 count = fShelf->CountReplicants(); - if (count <= 0) + int32 replicantCount = ReplicantCount(); + if (replicantCount <= 0) return; if (startIndex == 0) @@ -1298,12 +1298,12 @@ TReplicantTray::SaveTimeSettings() /*! Draggable region that is asynchronous so that dragging does not block other activities. */ -TDragRegion::TDragRegion(TBarView* parent, BView* child) +TDragRegion::TDragRegion(TBarView* parent, BView* replicantTray) : BControl(BRect(0, 0, 0, 0), "", "", NULL, B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS), fBarView(parent), - fChild(child), + fReplicantTray(replicantTray), fDragLocation(kAutoPlaceDragRegion) { } @@ -1326,9 +1326,9 @@ TDragRegion::AttachedToWindow() void TDragRegion::GetPreferredSize(float* width, float* height) { - fChild->ResizeToPreferred(); - *width = fChild->Bounds().Width(); - *height = fChild->Bounds().Height(); + fReplicantTray->ResizeToPreferred(); + *width = fReplicantTray->Bounds().Width(); + *height = fReplicantTray->Bounds().Height(); if (fDragLocation != kNoDragRegion) *width += kDragWidth + kGutter; diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h index 6c1761f66a..6fd82183f9 100644 --- a/src/apps/deskbar/StatusView.h +++ b/src/apps/deskbar/StatusView.h @@ -107,7 +107,7 @@ public: bool IconExists(int32 target, bool byIndex = false); bool IconExists(const char* name); - int32 IconCount() const; + int32 ReplicantCount() const; status_t AddIcon(BMessage*, int32* id, const entry_ref* = NULL); @@ -160,7 +160,7 @@ private: #endif BPoint LocationForReplicant(int32 index, - float width); + float replicantWidth); BShelf* Shelf() const; status_t _SaveSettings(); @@ -196,7 +196,7 @@ enum { class TDragRegion : public BControl { public: - TDragRegion(TBarView* barView, BView* child); + TDragRegion(TBarView* barView, BView* replicantTray); virtual void AttachedToWindow(); virtual void GetPreferredSize(float*, float*); @@ -218,7 +218,7 @@ public: private: TBarView* fBarView; - BView* fChild; + BView* fReplicantTray; BPoint fPreviousPosition; int32 fDragLocation; };