* resolved ticket #1880
* implemented center on first start * removed TODO's as they where partly implemented git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25047 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9c89c45059
commit
dbf2630af2
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
* Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -59,13 +59,7 @@ BackgroundsWindow::BackgroundsWindow(BRect frame, bool standalone)
|
||||||
{
|
{
|
||||||
fBackgroundsView = new BackgroundsView(Bounds(), "BackgroundsView",
|
fBackgroundsView = new BackgroundsView(Bounds(), "BackgroundsView",
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
fBackgroundsView->ResizeToPreferred();
|
|
||||||
ResizeTo(fBackgroundsView->Bounds().Width(), fBackgroundsView->Bounds().Height());
|
|
||||||
|
|
||||||
AddChild(fBackgroundsView);
|
AddChild(fBackgroundsView);
|
||||||
|
|
||||||
// TODO: center on screen
|
|
||||||
// TODO: save window position?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
|
* Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -231,22 +231,18 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
||||||
fXPlacementText->MoveBy(0, delta);
|
fXPlacementText->MoveBy(0, delta);
|
||||||
fYPlacementText->MoveBy(0, delta);
|
fYPlacementText->MoveBy(0, delta);
|
||||||
|
|
||||||
fRevert = new BButton(BRect(fPreview->Frame().left, fPreview->Frame().bottom + 10,
|
rect = fPreview->Frame();
|
||||||
fPreview->Frame().left + 80, Frame().bottom - 10), "RevertButton",
|
rect.top = rect.bottom + 10.0;
|
||||||
"Revert", new BMessage(kMsgRevertSettings), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
fRevert = new BButton(rect, "revert", "Revert", new BMessage(kMsgRevertSettings));
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
|
||||||
fRevert->ResizeToPreferred();
|
|
||||||
AddChild(fRevert);
|
AddChild(fRevert);
|
||||||
|
fRevert->ResizeToPreferred();
|
||||||
|
|
||||||
fApply = new BButton(BRect(rightbox->Frame().right, fPreview->Frame().bottom
|
rect.left = rightbox->Frame().right;
|
||||||
+ 10, rightbox->Frame().right, 110), "ApplyButton", "Apply",
|
fApply = new BButton(rect, "apply", "Apply", new BMessage(kMsgApplySettings));
|
||||||
new BMessage(kMsgApplySettings), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM,
|
AddChild(fApply);
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
|
||||||
fApply->ResizeToPreferred();
|
fApply->ResizeToPreferred();
|
||||||
fApply->MoveBy(-fApply->Bounds().Width(), 0);
|
fApply->MoveBy(-fApply->Bounds().Width(), 0);
|
||||||
AddChild(fApply);
|
fApply->MakeDefault(true);
|
||||||
|
|
||||||
ResizeTo(rightbox->Frame().right + 10, fApply->Frame().bottom + 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +276,14 @@ BackgroundsView::AllAttached()
|
||||||
fApply->SetTarget(this);
|
fApply->SetTarget(this);
|
||||||
fRevert->SetTarget(this);
|
fRevert->SetTarget(this);
|
||||||
|
|
||||||
fPanel = new ImageFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
|
BPath path;
|
||||||
|
entry_ref ref;
|
||||||
|
if (find_directory(B_BEOS_ETC_DIRECTORY, &path) == B_OK) {
|
||||||
|
path.Append("artwork");
|
||||||
|
get_ref_for_path(path.Path(), &ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
fPanel = new ImageFilePanel(B_OPEN_PANEL, new BMessenger(this), &ref,
|
||||||
B_FILE_NODE, false, NULL, new CustomRefFilter(true));
|
B_FILE_NODE, false, NULL, new CustomRefFilter(true));
|
||||||
fPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
|
||||||
|
@ -288,10 +291,24 @@ BackgroundsView::AllAttached()
|
||||||
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
||||||
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
|
||||||
Window()->ResizeTo(Frame().Width(), Frame().Height());
|
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
LoadDesktopFolder();
|
LoadDesktopFolder();
|
||||||
|
|
||||||
|
float width, height;
|
||||||
|
GetPreferredSize(&width, &height);
|
||||||
|
|
||||||
|
BPoint point;
|
||||||
|
if (fSettings.FindPoint("pos", &point) != B_OK) {
|
||||||
|
BRect frame(BScreen().Frame());
|
||||||
|
point.Set((frame.right - width) / 2, (frame.bottom - height) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResizeTo(width, height);
|
||||||
|
Window()->MoveTo(point);
|
||||||
|
Window()->ResizeTo(width, height);
|
||||||
|
|
||||||
|
fApply->SetEnabled(false);
|
||||||
|
fRevert->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -797,10 +814,6 @@ BackgroundsView::LoadSettings()
|
||||||
|
|
||||||
PRINT_OBJECT(fSettings);
|
PRINT_OBJECT(fSettings);
|
||||||
|
|
||||||
BPoint point;
|
|
||||||
if (fSettings.FindPoint("pos", &point) == B_OK)
|
|
||||||
Window()->MoveTo(point);
|
|
||||||
|
|
||||||
BString string;
|
BString string;
|
||||||
if (fSettings.FindString("paneldir", &string) == B_OK)
|
if (fSettings.FindString("paneldir", &string) == B_OK)
|
||||||
fPanel->SetPanelDirectory(string.String());
|
fPanel->SetPanelDirectory(string.String());
|
||||||
|
|
Loading…
Reference in New Issue