diff --git a/src/kits/tracker/IconMenuItem.cpp b/src/kits/tracker/IconMenuItem.cpp index 03dcee79dc..3c95a305d2 100644 --- a/src/kits/tracker/IconMenuItem.cpp +++ b/src/kits/tracker/IconMenuItem.cpp @@ -126,7 +126,7 @@ ModelMenuItem::DrawContent() { if (fDrawText) { BPoint drawPoint(ContentLocation()); - drawPoint.x += 20 + (fExtraPad ? 6 : 0); + drawPoint.x += ListIconSize() + (fExtraPad ? 10 : 4); if (fHeightDelta > 0) drawPoint.y += ceil(fHeightDelta / 2); Menu()->MovePenTo(drawPoint); @@ -164,12 +164,12 @@ ModelMenuItem::DrawIcon() // draw small icon, synchronously if (IsEnabled()) { IconCache::sIconCache->Draw(fModel.ResolveIfLink(), Menu(), where, - kNormalIcon, B_MINI_ICON); + kNormalIcon, (icon_size)ListIconSize()); } else { // dimmed, for now use a special blitter; icon cache should // know how to blit one eventually IconCache::sIconCache->SyncDraw(fModel.ResolveIfLink(), Menu(), where, - kNormalIcon, B_MINI_ICON, DimmedIconBlitter); + kNormalIcon, (icon_size)ListIconSize(), DimmedIconBlitter); } Menu()->PopState(); @@ -180,10 +180,11 @@ void ModelMenuItem::GetContentSize(float* width, float* height) { _inherited::GetContentSize(width, height); - fHeightDelta = 16 - *height; - if (*height < 16) - *height = 16; - *width = *width + 20 + (fExtraPad ? 18 : 0); + float iconSize = ListIconSize(); + fHeightDelta = iconSize - *height; + if (*height < iconSize) + *height = iconSize; + *width = *width + 4 + iconSize + (fExtraPad ? 18 : 0); } diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 4e148435bd..7aa0f65e11 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -235,7 +235,6 @@ BPoseView::BPoseView(Model* model, uint32 viewMode) fCountView(NULL), fListElemHeight(0.0f), fIconPoseHeight(0.0f), - fListIconSize(0.0f), fDropTarget(NULL), fAlreadySelectedDropTarget(NULL), fSelectionHandler(be_app), @@ -278,9 +277,7 @@ BPoseView::BPoseView(Model* model, uint32 viewMode) fDeskbarFrame(0, 0, -1, -1), fTextWidgetToCheck(NULL) { - fListIconSize = std::max((float)B_MINI_ICON, - B_MINI_ICON * be_plain_font->Size() / 12); - fListElemHeight = std::max(fListIconSize, + fListElemHeight = std::fmax(ListIconSize(), ceilf(sFontHeight) < 20 ? 20 : ceilf(sFontHeight * 1.1f)); fViewState->SetViewMode(viewMode); @@ -1032,7 +1029,7 @@ BPoseView::SetIconPoseHeight() case kListMode: default: { - fViewState->SetIconSize(fListIconSize); + fViewState->SetIconSize(ListIconSize()); fIconPoseHeight = fListElemHeight; break; } diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index e936c44082..82a3ff5053 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -724,7 +724,6 @@ protected: BCountView* fCountView; float fListElemHeight; float fIconPoseHeight; - float fListIconSize; BPose* fDropTarget; BPose* fAlreadySelectedDropTarget; BLooper* fSelectionHandler; @@ -1065,7 +1064,7 @@ BPoseView::CountColumns() const inline float BPoseView::StartOffset() const { - return kListOffset + fListIconSize + kMiniIconSeparator + 1; + return kListOffset + ListIconSize() + kMiniIconSeparator + 1; } diff --git a/src/kits/tracker/Utilities.cpp b/src/kits/tracker/Utilities.cpp index faa5299fbb..7df1e80c09 100644 --- a/src/kits/tracker/Utilities.cpp +++ b/src/kits/tracker/Utilities.cpp @@ -1257,6 +1257,15 @@ StringToScalar(const char* text) } +int32 +ListIconSize() +{ + static int32 sIconSize = std::max((int32)B_MINI_ICON, + (int32)ceilf(B_MINI_ICON * be_plain_font->Size() / 12)); + return sIconSize; +} + + static BRect LineBounds(BPoint where, float length, bool vertical) { diff --git a/src/kits/tracker/Utilities.h b/src/kits/tracker/Utilities.h index ab0d708142..687366abd7 100644 --- a/src/kits/tracker/Utilities.h +++ b/src/kits/tracker/Utilities.h @@ -417,6 +417,8 @@ const BMenuItem* EachMenuItem(const BMenu* menu, bool recursive, int64 StringToScalar(const char* text); // string to num, understands kB, MB, etc. +int32 ListIconSize(); + // misc calls void EmbedUniqueVolumeInfo(BMessage* message, const BVolume* volume); status_t MatchArchivedVolume(BVolume* volume, const BMessage* message,