Sounds: Center initial window.

* Now uses BWindow::MoveOnScreen().
This commit is contained in:
Axel Dörfler
2015-09-14 20:46:00 +02:00
parent 8bf216d6dd
commit 8d46a99fe9
2 changed files with 6 additions and 7 deletions
+3 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku. All rights reserved. * Copyright 2003-2015, Haiku. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -25,10 +25,8 @@ HApp::HApp()
: :
BApplication("application/x-vnd.Haiku-Sounds") BApplication("application/x-vnd.Haiku-Sounds")
{ {
BRect rect; HWindow* window = new HWindow(BRect(-1, -1, 390, 420),
rect.Set(200, 150, 590, 570); B_TRANSLATE_SYSTEM_NAME("Sounds"));
HWindow* window = new HWindow(rect, B_TRANSLATE_SYSTEM_NAME("Sounds"));
window->Show(); window->Show();
} }
+3 -2
View File
@@ -56,18 +56,19 @@ HWindow::HWindow(BRect rect, const char* name)
fFilePanel->SetTarget(this); fFilePanel->SetTarget(this);
BPath path; BPath path;
BMessage msg;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(kSettingsFile); path.Append(kSettingsFile);
BFile file(path.Path(), B_READ_ONLY); BFile file(path.Path(), B_READ_ONLY);
BMessage msg;
if (file.InitCheck() == B_OK && msg.Unflatten(&file) == B_OK if (file.InitCheck() == B_OK && msg.Unflatten(&file) == B_OK
&& msg.FindRect("frame", &fFrame) == B_OK) { && msg.FindRect("frame", &fFrame) == B_OK) {
MoveTo(fFrame.LeftTop()); MoveTo(fFrame.LeftTop());
ResizeTo(fFrame.Width(), fFrame.Height()); ResizeTo(fFrame.Width(), fFrame.Height());
} }
} }
MoveOnScreen();
} }