Tracker: made title view height depend on font size.
* It now uses a font that's 3/4 the size of the plain font; ie. there shouldn't be any change with the default font size. * Also cleaned up some weird layout code on the way.
This commit is contained in:
@@ -953,18 +953,12 @@ BContainerWindow::Init(const BMessage* message)
|
|||||||
void
|
void
|
||||||
BContainerWindow::InitLayout()
|
BContainerWindow::InitLayout()
|
||||||
{
|
{
|
||||||
BLayoutItem* item
|
fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
|
||||||
= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
|
|
||||||
BSize minSize = item->MinSize();
|
|
||||||
BSize maxSize = item->MaxSize();
|
|
||||||
item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
|
|
||||||
item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));
|
|
||||||
|
|
||||||
item = fCountContainer->GroupLayout()->AddView(fPoseView->CountView());
|
BLayoutItem* item = fCountContainer->GroupLayout()->AddView(
|
||||||
minSize = item->MinSize();
|
fPoseView->CountView());
|
||||||
maxSize = item->MaxSize();
|
|
||||||
item->SetExplicitMinSize(BSize(kCountViewWidth, B_H_SCROLL_BAR_HEIGHT));
|
item->SetExplicitMinSize(BSize(kCountViewWidth, B_H_SCROLL_BAR_HEIGHT));
|
||||||
item->SetExplicitMaxSize(BSize(kCountViewWidth, maxSize.Height()));
|
item->SetExplicitMaxSize(BSize(kCountViewWidth, B_SIZE_UNSET));
|
||||||
|
|
||||||
// Eliminate the extra borders
|
// Eliminate the extra borders
|
||||||
fMenuContainer->GroupLayout()->SetInsets(0, 0, -1, 0);
|
fMenuContainer->GroupLayout()->SetInsets(0, 0, -1, 0);
|
||||||
|
|||||||
@@ -899,12 +899,7 @@ TFilePanel::RestoreState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finish UI creation now that the PoseView is initialized
|
// Finish UI creation now that the PoseView is initialized
|
||||||
BLayoutItem* item
|
fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
|
||||||
= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
|
|
||||||
BSize minSize = item->MinSize();
|
|
||||||
BSize maxSize = item->MaxSize();
|
|
||||||
item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
|
|
||||||
item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));
|
|
||||||
|
|
||||||
BRect rect(fBorderedView->Frame());
|
BRect rect(fBorderedView->Frame());
|
||||||
rect.right = rect.left + kCountViewWidth;
|
rect.right = rect.left + kCountViewWidth;
|
||||||
|
|||||||
@@ -9911,7 +9911,7 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll)
|
|||||||
border.bottom = border.top;
|
border.bottom = border.top;
|
||||||
border.top -= kBorderHeight;
|
border.top -= kBorderHeight;
|
||||||
if (ViewMode() == kListMode)
|
if (ViewMode() == kListMode)
|
||||||
border.top -= kTitleViewHeight;
|
border.top -= TitleView()->Bounds().Height();
|
||||||
|
|
||||||
bool selectionScrolling = fSelectionRectInfo.isDragging;
|
bool selectionScrolling = fSelectionRectInfo.isDragging;
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,13 @@ BTitleView::BTitleView(BPoseView* view)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
BFont font(be_plain_font);
|
BFont font(be_plain_font);
|
||||||
font.SetSize(9);
|
font.SetSize(floorf(be_plain_font->Size() * 0.75f));
|
||||||
SetFont(&font);
|
SetFont(&font);
|
||||||
|
|
||||||
|
font_height height;
|
||||||
|
GetFontHeight(&height);
|
||||||
|
fPreferredHeight = ceilf(height.ascent + height.descent) + 2;
|
||||||
|
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +194,20 @@ BTitleView::RemoveTitle(BColumn* column)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSize
|
||||||
|
BTitleView::MinSize()
|
||||||
|
{
|
||||||
|
return BSize(16, fPreferredHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSize
|
||||||
|
BTitleView::MaxSize()
|
||||||
|
{
|
||||||
|
return BSize(B_SIZE_UNLIMITED, fPreferredHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::Draw(BRect rect)
|
BTitleView::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
@@ -215,8 +233,8 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
|
|||||||
view->SetOrigin(-bounds.left, 0);
|
view->SetOrigin(-bounds.left, 0);
|
||||||
view->SetLowColor(LowColor());
|
view->SetLowColor(LowColor());
|
||||||
view->SetHighColor(HighColor());
|
view->SetHighColor(HighColor());
|
||||||
BFont font(be_plain_font);
|
BFont font;
|
||||||
font.SetSize(9);
|
GetFont(&font);
|
||||||
view->SetFont(&font);
|
view->SetFont(&font);
|
||||||
} else
|
} else
|
||||||
view = this;
|
view = this;
|
||||||
@@ -452,7 +470,7 @@ BRect
|
|||||||
BColumnTitle::Bounds() const
|
BColumnTitle::Bounds() const
|
||||||
{
|
{
|
||||||
BRect bounds(fColumn->Offset() - kTitleColumnLeftExtraMargin, 0, 0,
|
BRect bounds(fColumn->Offset() - kTitleColumnLeftExtraMargin, 0, 0,
|
||||||
kTitleViewHeight);
|
fParent->Bounds().Height());
|
||||||
bounds.right = bounds.left + fColumn->Width() + kTitleColumnExtraMargin;
|
bounds.right = bounds.left + fColumn->Width() + kTitleColumnExtraMargin;
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
@@ -463,7 +481,10 @@ void
|
|||||||
BColumnTitle::Draw(BView* view, bool pressed)
|
BColumnTitle::Draw(BView* view, bool pressed)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
BPoint loc(0, bounds.bottom - 4);
|
|
||||||
|
font_height height;
|
||||||
|
view->GetFontHeight(&height);
|
||||||
|
BPoint loc(0, bounds.top + ceilf(height.ascent) + 2);
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
bounds.bottom--;
|
bounds.bottom--;
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class BColumnTitle;
|
|||||||
class ColumnTrackState;
|
class ColumnTrackState;
|
||||||
class OffscreenBitmap;
|
class OffscreenBitmap;
|
||||||
|
|
||||||
const int32 kTitleViewHeight = 16;
|
|
||||||
const int32 kEdgeSize = 6;
|
const int32 kEdgeSize = 6;
|
||||||
const int32 kTitleColumnLeftExtraMargin = 11;
|
const int32 kTitleColumnLeftExtraMargin = 11;
|
||||||
const int32 kTitleColumnRightExtraMargin = 5;
|
const int32 kTitleColumnRightExtraMargin = 5;
|
||||||
@@ -70,6 +69,9 @@ public:
|
|||||||
virtual void MouseUp(BPoint where);
|
virtual void MouseUp(BPoint where);
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
|
virtual BSize MinSize();
|
||||||
|
virtual BSize MaxSize();
|
||||||
|
|
||||||
void Draw(BRect, bool useOffscreen = false,
|
void Draw(BRect, bool useOffscreen = false,
|
||||||
bool updateOnly = true,
|
bool updateOnly = true,
|
||||||
const BColumnTitle* pressedColumn = 0,
|
const BColumnTitle* pressedColumn = 0,
|
||||||
@@ -90,9 +92,11 @@ private:
|
|||||||
BColumnTitle* InColumnResizeArea(BPoint) const;
|
BColumnTitle* InColumnResizeArea(BPoint) const;
|
||||||
BColumnTitle* FindColumnTitle(const BColumn*) const;
|
BColumnTitle* FindColumnTitle(const BColumn*) const;
|
||||||
|
|
||||||
|
private:
|
||||||
BPoseView* fPoseView;
|
BPoseView* fPoseView;
|
||||||
BObjectList<BColumnTitle> fTitleList;
|
BObjectList<BColumnTitle> fTitleList;
|
||||||
BCursor fHorizontalResizeCursor;
|
BCursor fHorizontalResizeCursor;
|
||||||
|
float fPreferredHeight;
|
||||||
|
|
||||||
BColumnTitle* fPreviouslyClickedColumnTitle;
|
BColumnTitle* fPreviouslyClickedColumnTitle;
|
||||||
bigtime_t fPreviousLeftClickTime;
|
bigtime_t fPreviousLeftClickTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user