made timestamp font sensitive

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17419 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-05-11 05:50:33 +00:00
parent 1655525f95
commit 8c2f5082ec
1 changed files with 18 additions and 15 deletions

View File

@ -82,8 +82,8 @@ TrackSlider::Draw(BRect updateRect)
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
SetHighColor(216,216,216); SetHighColor(216,216,216);
FillRect(BRect(0,1,fPositionX < 18 ? 18 : fPositionX-26,SLIDER_BASE)); FillRect(BRect(0,1,fPositionX < 18 ? 18 : fPositionX-22,SLIDER_BASE));
FillRect(BRect(fPositionX < 18 ? 65 : fPositionX > fRight - 3 ? fRight : fPositionX+26,0,Bounds().right,SLIDER_BASE)); FillRect(BRect(fPositionX < 18 ? 65 : fPositionX > fRight - 3 ? fRight : fPositionX+22,0,Bounds().right,SLIDER_BASE));
FillRect(BRect(0,0,Bounds().right,0)); FillRect(BRect(0,0,Bounds().right,0));
FillRect(BRect(0,SLIDER_BASE+18,Bounds().right,SLIDER_BASE+21)); FillRect(BRect(0,SLIDER_BASE+18,Bounds().right,SLIDER_BASE+21));
FillRect(BRect(0,0,10,SLIDER_BASE+21)); FillRect(BRect(0,0,10,SLIDER_BASE+21));
@ -234,27 +234,32 @@ TrackSlider::DrawCounter(bigtime_t timestamp, float position, bool isTracking)
rgb_color blue2 = {146,146,214}; rgb_color blue2 = {146,146,214};
rgb_color white = {255,255,255}; rgb_color white = {255,255,255};
char string[12];
TimeToString(timestamp, string);
int32 halfwidth = ((int32)fFont.StringWidth(string)) / 2;
float counterX = position; float counterX = position;
if (counterX < 39) if (counterX < 39)
counterX = 39; counterX = 39;
if (counterX > fRight - 23) if (counterX > fRight - 23)
counterX = fRight - 23; counterX = fRight - 23;
BeginLineArray(30);
BeginLineArray(4);
if (!isTracking) { if (!isTracking) {
AddLine(BPoint(counterX-24,SLIDER_BASE+1), BPoint(counterX+24,SLIDER_BASE+1), gray); AddLine(BPoint(counterX-halfwidth-3,SLIDER_BASE+1), BPoint(counterX+halfwidth+3,SLIDER_BASE+1), gray);
AddLine(BPoint(counterX+25,SLIDER_BASE+1), BPoint(counterX+25,SLIDER_BASE-8), gray); AddLine(BPoint(counterX+halfwidth+4,SLIDER_BASE+1), BPoint(counterX+halfwidth+4,SLIDER_BASE-8), gray);
AddLine(BPoint(counterX-25,SLIDER_BASE+1), BPoint(counterX-25,SLIDER_BASE-9), white); AddLine(BPoint(counterX-halfwidth-4,SLIDER_BASE+1), BPoint(counterX-halfwidth-4,SLIDER_BASE-9), white);
AddLine(BPoint(counterX-24,SLIDER_BASE-9), BPoint(counterX+25,SLIDER_BASE-9), white); AddLine(BPoint(counterX-halfwidth-3,SLIDER_BASE-9), BPoint(counterX+halfwidth+4,SLIDER_BASE-9), white);
SetHighColor(216,216,216); SetHighColor(216,216,216);
} else { } else {
AddLine(BPoint(counterX-24,SLIDER_BASE+1), BPoint(counterX+24,SLIDER_BASE+1), blue); AddLine(BPoint(counterX-halfwidth-3,SLIDER_BASE+1), BPoint(counterX+halfwidth+3,SLIDER_BASE+1), blue);
AddLine(BPoint(counterX+25,SLIDER_BASE+1), BPoint(counterX+25,SLIDER_BASE-9), blue2); AddLine(BPoint(counterX+halfwidth+4,SLIDER_BASE+1), BPoint(counterX+halfwidth+4,SLIDER_BASE-9), blue2);
AddLine(BPoint(counterX-25,SLIDER_BASE+1), BPoint(counterX-25,SLIDER_BASE-9), blue2); AddLine(BPoint(counterX-halfwidth-4,SLIDER_BASE+1), BPoint(counterX-halfwidth-4,SLIDER_BASE-9), blue2);
AddLine(BPoint(counterX-24,SLIDER_BASE-9), BPoint(counterX+24,SLIDER_BASE-9), blue2); AddLine(BPoint(counterX-halfwidth-3,SLIDER_BASE-9), BPoint(counterX+halfwidth+3,SLIDER_BASE-9), blue2);
SetHighColor(48,48,241); SetHighColor(48,48,241);
} }
EndLineArray(); EndLineArray();
FillRect(BRect(counterX-24,SLIDER_BASE-8,counterX+24,SLIDER_BASE)); FillRect(BRect(counterX-halfwidth-3,SLIDER_BASE-8,counterX+halfwidth+3,SLIDER_BASE));
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
if (isTracking) if (isTracking)
@ -264,9 +269,7 @@ TrackSlider::DrawCounter(bigtime_t timestamp, float position, bool isTracking)
SetLowColor(ViewColor()); SetLowColor(ViewColor());
SetFont(&fFont); SetFont(&fFont);
char string[12]; DrawString(string, BPoint(counterX-halfwidth, SLIDER_BASE-1));
TimeToString(timestamp, string);
DrawString(string, BPoint(counterX-22, SLIDER_BASE-1));
} }