cosmetical improvements to status view, it also shows the image size now
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9113 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
33140fa001
commit
0cd4ecd8b2
@ -32,12 +32,54 @@ ShowImageStatusView::ShowImageStatusView(BRect rect, const char* name,
|
||||
uint32 resizingMode, uint32 flags)
|
||||
: BView(rect, name, resizingMode, flags)
|
||||
{
|
||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetHighColor(0, 0, 0, 255);
|
||||
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
font.SetSize(10.0);
|
||||
SetFont(&font);
|
||||
}
|
||||
|
||||
void
|
||||
ShowImageStatusView::Draw(BRect updateRect)
|
||||
{
|
||||
DrawString(fText.String(), BPoint(3, 11));
|
||||
rgb_color darkShadow = tint_color(LowColor(), B_DARKEN_2_TINT);
|
||||
rgb_color shadow = tint_color(LowColor(), B_DARKEN_1_TINT);
|
||||
rgb_color light = tint_color(LowColor(), B_LIGHTEN_MAX_TINT);
|
||||
|
||||
BRect b(Bounds());
|
||||
|
||||
BeginLineArray(5);
|
||||
AddLine(BPoint(b.left, b.top),
|
||||
BPoint(b.right, b.top), darkShadow);
|
||||
b.top += 1.0;
|
||||
AddLine(BPoint(b.left, b.top),
|
||||
BPoint(b.right, b.top), light);
|
||||
AddLine(BPoint(b.right, b.top + 1.0),
|
||||
BPoint(b.right, b.bottom), shadow);
|
||||
AddLine(BPoint(b.right - 1.0, b.bottom),
|
||||
BPoint(b.left + 1.0, b.bottom), shadow);
|
||||
AddLine(BPoint(b.left, b.bottom),
|
||||
BPoint(b.left, b.top + 1.0), light);
|
||||
EndLineArray();
|
||||
|
||||
b.InsetBy(1.0, 1.0);
|
||||
|
||||
// truncate and layout text
|
||||
BString truncated(fText);
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
font.TruncateString(&truncated, B_TRUNCATE_MIDDLE, b.Width() - 4.0);
|
||||
font_height fh;
|
||||
font.GetHeight(&fh);
|
||||
|
||||
FillRect(b, B_SOLID_LOW);
|
||||
SetDrawingMode(B_OP_OVER);
|
||||
DrawString(truncated.String(), BPoint(b.left + 2.0,
|
||||
floorf(b.top + b.Height() / 2.0
|
||||
+ fh.ascent / 2.0)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -288,6 +288,9 @@ ShowImageView::Notify(const char* status)
|
||||
if (status != NULL) {
|
||||
msg.AddString("status", status);
|
||||
}
|
||||
msg.AddInt32("width", fBitmap->Bounds().IntegerWidth() + 1);
|
||||
msg.AddInt32("height", fBitmap->Bounds().IntegerHeight() + 1);
|
||||
|
||||
msg.AddInt32("colors", fBitmap->ColorSpace());
|
||||
BMessenger msgr(Window());
|
||||
msgr.SendMessage(&msg);
|
||||
|
@ -138,9 +138,9 @@ ShowImageWindow::ShowImageWindow(const entry_ref *pref, const BMessenger& tracke
|
||||
|
||||
rect.left = 0;
|
||||
rect.right = kstatusWidth - 1;
|
||||
rect.bottom -= 1;
|
||||
fStatusView = new ShowImageStatusView(rect, "status_view", B_FOLLOW_BOTTOM,
|
||||
B_WILL_DRAW);
|
||||
fStatusView->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
AddChild(fStatusView);
|
||||
|
||||
rect = Bounds();
|
||||
@ -559,9 +559,18 @@ ShowImageWindow::MessageReceived(BMessage *pmsg)
|
||||
pmsg->FindInt32("colors", reinterpret_cast<int32 *>(&colors));
|
||||
EnableMenuItem(fBar, MSG_INVERT, (colors != B_CMAP8));
|
||||
|
||||
BString status;
|
||||
int32 width, height;
|
||||
if (pmsg->FindInt32("width", &width) >= B_OK
|
||||
&& pmsg->FindInt32("height", &height) >= B_OK) {
|
||||
status << width << "x" << height << ", ";
|
||||
}
|
||||
|
||||
BString str;
|
||||
if (pmsg->FindString("status", &str) == B_OK)
|
||||
fStatusView->SetText(str);
|
||||
status << str;
|
||||
|
||||
fStatusView->SetText(status);
|
||||
|
||||
UpdateTitle();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user