Fixed some of the simpler font sensitivity problems. Looks much better on the real thing now.

Also no longer states that Haiku components would be part of "the BeOS" :-)
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13143 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-06-15 05:20:10 +00:00
parent e8fbd2527f
commit d145df451e
@@ -1,9 +1,9 @@
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
//
// Copyright (c) 2004, Haiku
// Copyright (c) 2004-2005, Haiku
//
// This software is part of the Haiku distribution and is covered
// by the Haiku license.
// by the MIT license.
//
//
// File: TMWindow.cpp
@@ -13,6 +13,7 @@
//
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#include "TMWindow.h"
#include "TMListItem.h"
#include "KeyboardInputDevice.h"
@@ -20,6 +21,7 @@
#include <ScrollView.h>
#include <Screen.h>
const uint32 TM_CANCEL = 'TMca';
const uint32 TM_FORCE_REBOOT = 'TMfr';
const uint32 TM_KILL_APPLICATION = 'TMka';
@@ -32,6 +34,7 @@ extern "C" void _kshutdown_(bool reboot);
# define _kshutdown_(x) _kern_shutdown(x)
#endif
TMWindow::TMWindow()
: BWindow(BRect(0,0,350,300), "Team Monitor",
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
@@ -41,7 +44,10 @@ TMWindow::TMWindow()
{
Lock();
// ToDo: make this font sensitive
BRect rect = Bounds();
BFont font = be_plain_font;
fBackground = new TMBox(rect, "background", B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW, B_NO_BORDER);
@@ -49,7 +55,7 @@ TMWindow::TMWindow()
rect = Bounds();
rect.right -= 10;
rect.left = rect.right - 75;
rect.left = rect.right - font.StringWidth("Cancel") - 20;
rect.bottom -= 14;
rect.top = rect.bottom - 20;
@@ -59,7 +65,7 @@ TMWindow::TMWindow()
SetDefaultButton(cancel);
rect.left = 10;
rect.right = rect.left + 83;
rect.right = rect.left + font.StringWidth("Force Reboot") + 20;
BButton *forceReboot = new BButton(rect, "force", "Force Reboot",
new BMessage(TM_FORCE_REBOOT), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
@@ -67,7 +73,7 @@ TMWindow::TMWindow()
rect.top -= 97;
rect.bottom = rect.top + 20;
rect.right += 1;
rect.right = rect.left + font.StringWidth("Kill Application") + 20;
fKillApp = new BButton(rect, "kill", "Kill Application",
new BMessage(TM_KILL_APPLICATION), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
@@ -81,12 +87,12 @@ TMWindow::TMWindow()
fBackground->AddChild(fDescView);
BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame());
BPoint pt;
pt.x = screenFrame.Width()/2 - Bounds().Width()/2;
pt.y = screenFrame.Height()/2 - Bounds().Height()/2;
BPoint point;
point.x = (screenFrame.Width() - Bounds().Width()) / 2;
point.y = (screenFrame.Height() - Bounds().Height()) / 2;
if (screenFrame.Contains(pt))
MoveTo(pt);
if (screenFrame.Contains(point))
MoveTo(point);
Unlock();
}
@@ -94,16 +100,13 @@ TMWindow::TMWindow()
TMWindow::~TMWindow()
{
}
void
TMWindow::MessageReceived(BMessage *msg)
{
switch(msg->what)
{
switch (msg->what) {
case TM_FORCE_REBOOT:
_kshutdown_(true);
break;
@@ -163,11 +166,13 @@ TMWindow::Disable()
}
// #pragma mark -
TMBox::TMBox(BRect bounds, const char* name, uint32 resizeFlags,
uint32 flags, border_style border)
: BBox(bounds, name, resizeFlags, flags | B_PULSE_NEEDED, border)
{
BRect rect = Bounds();
rect.InsetBy(12, 11);
rect.right -= B_V_SCROLL_BAR_WIDTH;
@@ -181,7 +186,6 @@ TMBox::TMBox(BRect bounds, const char* name, uint32 resizeFlags,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, 0, false, true, B_FANCY_BORDER);
AddChild(sv);
}
@@ -227,12 +231,13 @@ TMBox::Pulse()
}
// #pragma mark -
TMDescView::TMDescView(BRect rect)
: BBox(rect, "descview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER),
fItem(NULL)
{
}
@@ -258,7 +263,7 @@ TMDescView::Draw(BRect rect)
if (fItem->IsSystemServer()) {
MovePenTo(frame.right+9, frame.top + 1 + ((frame.Height() - (finfo.ascent + finfo.descent + finfo.leading)) *3 / 4) +
(finfo.ascent + finfo.descent) - 1);
DrawString("(This team is a component of the BeOS");
DrawString("(This team is a system component");
}
} else {
BFont font = be_plain_font;
@@ -268,16 +273,15 @@ TMDescView::Draw(BRect rect)
BPoint point(rect.left+4, rect.top - 9 + ((rect.Height() - (finfo.ascent + finfo.descent + finfo.leading)) / 4) +
(finfo.ascent + finfo.descent) - 1);
MovePenTo(point);
DrawString("Select an application from the list above and click the \"Kill\" button in");
DrawString("Select an application from the list above and click the");
point.y += 13;
MovePenTo(point);
DrawString("order to close it.");
DrawString("\"Kill Application\" button in order to close it.");
point.y += 26;
MovePenTo(point);
DrawString("Hold CONTROL+ALT+DELETE for 4 seconds to reboot.");
}
}