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
+22 -26
View File
@@ -844,18 +844,18 @@ ShowImageView::LayoutCaption(BFont &font, BPoint &pos, BRect &rect)
float width, height; float width, height;
BRect bounds(Bounds()); BRect bounds(Bounds());
font = be_plain_font; font = be_plain_font;
width = font.StringWidth(fCaption.String()) + 1; // 1 for text shadow width = font.StringWidth(fCaption.String());
font.GetHeight(&fontHeight); font.GetHeight(&fontHeight);
height = fontHeight.ascent + fontHeight.descent; height = fontHeight.ascent + fontHeight.descent;
// center text horizontally // center text horizontally
pos.x = (bounds.left + bounds.right - width) / 2; pos.x = (bounds.left + bounds.right - width) / 2;
// flush bottom // flush bottom
pos.y = bounds.bottom - fontHeight.descent - 5; pos.y = bounds.bottom - fontHeight.descent - 7;
// background rectangle // 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.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() ShowImageView::DrawCaption()
{ {
BFont font; BFont font;
BPoint pos; BPoint position;
BRect rect; BRect rect;
LayoutCaption(font, pos, rect); LayoutCaption(font, position, rect);
PushState(); PushState();
// draw background // draw background
SetDrawingMode(B_OP_ALPHA); SetDrawingMode(B_OP_ALPHA);
SetHighColor(0, 0, 255, 128); SetHighColor(255, 255, 255, 128);
FillRect(rect); FillRect(rect);
// draw text // draw text
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
SetFont(&font); SetFont(&font);
SetLowColor(B_TRANSPARENT_COLOR); SetLowColor(B_TRANSPARENT_COLOR);
// text shadow
pos += BPoint(1, 1);
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
SetPenSize(1); DrawString(fCaption.String(), position);
DrawString(fCaption.String(), pos);
// text
pos -= BPoint(1, 1);
SetHighColor(255, 255, 0);
DrawString(fCaption.String(), pos);
PopState(); PopState();
} }
@@ -952,8 +948,14 @@ ShowImageView::DrawImage(BRect rect)
void void
ShowImageView::Draw(BRect updateRect) ShowImageView::Draw(BRect updateRect)
{ {
if (fBitmap) { if (fBitmap == NULL)
if (!IsPrinting()) { return;
if (IsPrinting()) {
DrawBitmap(fBitmap);
return;
}
BRect rect = AlignBitmap(); BRect rect = AlignBitmap();
Setup(rect); Setup(rect);
@@ -968,12 +970,8 @@ ShowImageView::Draw(BRect updateRect)
// Draw image // Draw image
DrawImage(rect); DrawImage(rect);
if (fShowCaption) { if (fShowCaption)
// fShowCaption is set to false by ScrollRestricted()
// to prevent the caption from dirtying up the image
// during scrolling.
DrawCaption(); DrawCaption();
}
if (HasSelection()) { if (HasSelection()) {
if (fSelBitmap) { if (fSelBitmap) {
@@ -984,10 +982,6 @@ ShowImageView::Draw(BRect updateRect)
} }
DrawSelectionBox(); DrawSelectionBox();
} }
} else {
DrawBitmap(fBitmap);
}
}
} }
@@ -1572,6 +1566,8 @@ ShowImageView::ScrollRestricted(float x, float y, bool absolute)
// hide the caption when using mouse wheel // hide the caption when using mouse wheel
// in full screen mode // in full screen mode
// to prevent the caption from dirtying up the image
// during scrolling.
bool caption = fShowCaption; bool caption = fShowCaption;
if (caption) { if (caption) {
fShowCaption = false; fShowCaption = false;