Made the caption in full screen mode a bit easier to look at (boring yes, but some

people out there just aren't colour blind :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16279 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-02-07 12:23:26 +00:00
parent 71a34702d3
commit c70cd57756
+23 -27
View File
@@ -844,18 +844,18 @@ ShowImageView::LayoutCaption(BFont &font, BPoint &pos, BRect &rect)
float width, height;
BRect bounds(Bounds());
font = be_plain_font;
width = font.StringWidth(fCaption.String()) + 1; // 1 for text shadow
width = font.StringWidth(fCaption.String());
font.GetHeight(&fontHeight);
height = fontHeight.ascent + fontHeight.descent;
// center text horizontally
pos.x = (bounds.left + bounds.right - width)/2;
pos.x = (bounds.left + bounds.right - width) / 2;
// flush bottom
pos.y = bounds.bottom - fontHeight.descent - 5;
pos.y = bounds.bottom - fontHeight.descent - 7;
// background rectangle
rect.Set(0, 0, (width-1)+2, (height-1)+2+1); // 2 for border and 1 for text shadow
rect.Set(0, 0, width + 4, height + 4);
rect.OffsetTo(pos);
rect.OffsetBy(-1, -1-fontHeight.ascent); // -1 for border
rect.OffsetBy(-2, -2 - fontHeight.ascent); // -2 for border
}
@@ -863,28 +863,24 @@ void
ShowImageView::DrawCaption()
{
BFont font;
BPoint pos;
BPoint position;
BRect rect;
LayoutCaption(font, pos, rect);
LayoutCaption(font, position, rect);
PushState();
// draw background
SetDrawingMode(B_OP_ALPHA);
SetHighColor(0, 0, 255, 128);
SetHighColor(255, 255, 255, 128);
FillRect(rect);
// draw text
SetDrawingMode(B_OP_OVER);
SetFont(&font);
SetLowColor(B_TRANSPARENT_COLOR);
// text shadow
pos += BPoint(1, 1);
SetHighColor(0, 0, 0);
SetPenSize(1);
DrawString(fCaption.String(), pos);
// text
pos -= BPoint(1, 1);
SetHighColor(255, 255, 0);
DrawString(fCaption.String(), pos);
DrawString(fCaption.String(), position);
PopState();
}
@@ -952,8 +948,14 @@ ShowImageView::DrawImage(BRect rect)
void
ShowImageView::Draw(BRect updateRect)
{
if (fBitmap) {
if (!IsPrinting()) {
if (fBitmap == NULL)
return;
if (IsPrinting()) {
DrawBitmap(fBitmap);
return;
}
BRect rect = AlignBitmap();
Setup(rect);
@@ -968,12 +970,8 @@ ShowImageView::Draw(BRect updateRect)
// Draw image
DrawImage(rect);
if (fShowCaption) {
// fShowCaption is set to false by ScrollRestricted()
// to prevent the caption from dirtying up the image
// during scrolling.
if (fShowCaption)
DrawCaption();
}
if (HasSelection()) {
if (fSelBitmap) {
@@ -984,10 +982,6 @@ ShowImageView::Draw(BRect updateRect)
}
DrawSelectionBox();
}
} else {
DrawBitmap(fBitmap);
}
}
}
@@ -1572,6 +1566,8 @@ ShowImageView::ScrollRestricted(float x, float y, bool absolute)
// hide the caption when using mouse wheel
// in full screen mode
// to prevent the caption from dirtying up the image
// during scrolling.
bool caption = fShowCaption;
if (caption) {
fShowCaption = false;