Applied patch by Christof Lutteroth:
* The count/info view in Tracker truncates the text in a better way when it does not fit, and also used the space of the barber pool when it isn't displayed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24764 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -73,9 +73,12 @@ BCountView::TrySpinningBarberPole()
|
|||||||
if (fStartSpinningAfter && system_time() < fStartSpinningAfter)
|
if (fStartSpinningAfter && system_time() < fStartSpinningAfter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// When the barber pole just starts spinning we need to invalidate
|
||||||
|
// the whole rectangle of text and barber pole.
|
||||||
|
// After this the text needs no updating since only the pole changes.
|
||||||
if (fStartSpinningAfter) {
|
if (fStartSpinningAfter) {
|
||||||
fStartSpinningAfter = 0;
|
fStartSpinningAfter = 0;
|
||||||
Invalidate(BarberPoleOuterRect());
|
Invalidate(TextAndBarberPoleRect());
|
||||||
} else
|
} else
|
||||||
Invalidate(BarberPoleInnerRect());
|
Invalidate(BarberPoleInnerRect());
|
||||||
}
|
}
|
||||||
@@ -133,7 +136,19 @@ BCountView::TextInvalRect() const
|
|||||||
{
|
{
|
||||||
BRect result = Bounds();
|
BRect result = Bounds();
|
||||||
result.InsetBy(4, 2);
|
result.InsetBy(4, 2);
|
||||||
result.right -= 10;
|
|
||||||
|
// if the barber pole is not present, use its space for text
|
||||||
|
if(fShowingBarberPole)
|
||||||
|
result.right -= 10;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
BRect
|
||||||
|
BCountView::TextAndBarberPoleRect() const
|
||||||
|
{
|
||||||
|
BRect result = Bounds();
|
||||||
|
result.InsetBy(4, 2);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -154,7 +169,6 @@ void
|
|||||||
BCountView::Draw(BRect)
|
BCountView::Draw(BRect)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
BRect barberPoleRect;
|
|
||||||
BString itemString;
|
BString itemString;
|
||||||
if (!IsTypingAhead()) {
|
if (!IsTypingAhead()) {
|
||||||
if (fLastCount == 0)
|
if (fLastCount == 0)
|
||||||
@@ -166,14 +180,10 @@ BCountView::Draw(BRect)
|
|||||||
} else
|
} else
|
||||||
itemString << TypeAhead();
|
itemString << TypeAhead();
|
||||||
|
|
||||||
|
|
||||||
BString string(itemString);
|
BString string(itemString);
|
||||||
BRect textRect(TextInvalRect());
|
BRect textRect(TextInvalRect());
|
||||||
|
|
||||||
if (fShowingBarberPole && !fStartSpinningAfter) {
|
TruncateString(&string, B_TRUNCATE_END, textRect.Width());
|
||||||
barberPoleRect = BarberPoleOuterRect();
|
|
||||||
TruncateString(&string, B_TRUNCATE_END, textRect.Width());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsTypingAhead())
|
if (IsTypingAhead())
|
||||||
// use a muted gray for the typeahead
|
// use a muted gray for the typeahead
|
||||||
@@ -202,6 +212,8 @@ BCountView::Draw(BRect)
|
|||||||
EndLineArray();
|
EndLineArray();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BRect barberPoleRect(BarberPoleOuterRect());
|
||||||
|
|
||||||
AddLine(barberPoleRect.LeftTop(), barberPoleRect.RightTop(), shadow);
|
AddLine(barberPoleRect.LeftTop(), barberPoleRect.RightTop(), shadow);
|
||||||
AddLine(barberPoleRect.LeftTop(), barberPoleRect.LeftBottom(), shadow);
|
AddLine(barberPoleRect.LeftTop(), barberPoleRect.LeftBottom(), shadow);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ private:
|
|||||||
BRect BarberPoleInnerRect() const;
|
BRect BarberPoleInnerRect() const;
|
||||||
BRect BarberPoleOuterRect() const;
|
BRect BarberPoleOuterRect() const;
|
||||||
BRect TextInvalRect() const;
|
BRect TextInvalRect() const;
|
||||||
|
BRect TextAndBarberPoleRect() const;
|
||||||
void TrySpinningBarberPole();
|
void TrySpinningBarberPole();
|
||||||
|
|
||||||
int32 fLastCount;
|
int32 fLastCount;
|
||||||
|
|||||||
Reference in New Issue
Block a user