Fonts Preflet : The centering didn't work.

* Make use of CenterOnScreen(); to center the window rather than the dirty trick I tried months ago.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33071 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2009-09-12 01:39:18 +00:00
parent 608aa1d9db
commit 8a0ea31a5a
2 changed files with 3 additions and 22 deletions

View File

@ -36,8 +36,7 @@ static const uint32 kMsgCheckFonts = 'chkf';
MainWindow::MainWindow()
: BWindow(BRect(0, 0, 1, 1), "Fonts", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fCentered(false)
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
fDefaultsButton = new BButton("defaults", "Defaults",
new BMessage(kMsgSetDefaults), B_WILL_DRAW);
@ -77,19 +76,14 @@ MainWindow::MainWindow()
if (fSettings.WindowCorner() == BPoint(-1, -1)) {
// center window on screen
fCentered = true;
CenterOnScreen();
} else {
MoveTo(fSettings.WindowCorner());
// make sure window is on screen
BScreen screen(this);
if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame()))
fCentered = true;
}
if (fCentered) {
// draw offscreen to avoid flashing windows
MoveTo(BPoint(-1000, -1000));
CenterOnScreen();
}
fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000);
@ -99,16 +93,6 @@ MainWindow::MainWindow()
}
void
MainWindow::Show()
{
BWindow::Show();
if (fCentered)
_Center();
}
MainWindow::~MainWindow()
{
delete fRunner;

View File

@ -27,14 +27,11 @@ public:
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
virtual void Show();
private:
void _Center();
bool fCentered;
BMessageRunner* fRunner;
FontView* fFontsView;
BButton* fDefaultsButton;