Sounds: Center initial window.
* Now uses BWindow::MoveOnScreen().
This commit is contained in:
@@ -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.
|
||||
*
|
||||
* Authors:
|
||||
@@ -25,10 +25,8 @@ HApp::HApp()
|
||||
:
|
||||
BApplication("application/x-vnd.Haiku-Sounds")
|
||||
{
|
||||
BRect rect;
|
||||
rect.Set(200, 150, 590, 570);
|
||||
|
||||
HWindow* window = new HWindow(rect, B_TRANSLATE_SYSTEM_NAME("Sounds"));
|
||||
HWindow* window = new HWindow(BRect(-1, -1, 390, 420),
|
||||
B_TRANSLATE_SYSTEM_NAME("Sounds"));
|
||||
window->Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,18 +56,19 @@ HWindow::HWindow(BRect rect, const char* name)
|
||||
fFilePanel->SetTarget(this);
|
||||
|
||||
BPath path;
|
||||
BMessage msg;
|
||||
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||
path.Append(kSettingsFile);
|
||||
BFile file(path.Path(), B_READ_ONLY);
|
||||
|
||||
BMessage msg;
|
||||
if (file.InitCheck() == B_OK && msg.Unflatten(&file) == B_OK
|
||||
&& msg.FindRect("frame", &fFrame) == B_OK) {
|
||||
MoveTo(fFrame.LeftTop());
|
||||
ResizeTo(fFrame.Width(), fFrame.Height());
|
||||
}
|
||||
}
|
||||
|
||||
MoveOnScreen();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user