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.
|
* 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user