void
ToolSelectionWindow::showWindow()
{
    if (fSelectionWindow) {
        if (fSelectionWindow->Lock()) {
            fSelectionWindow->SetWorkspaces(B_CURRENT_WORKSPACE);

            if (fSelectionWindow->IsHidden())
                fSelectionWindow->Show();

            if (!fSelectionWindow->IsActive())
                fSelectionWindow->Activate(true);

            fSelectionWindow->Unlock();
        }
    } else {
        BRect frame(10, 31, 54, 596);
        if (SettingsServer* server = SettingsServer::Instance()) {
            BMessage settings;
            server->GetApplicationSettings(&settings);
            settings.FindRect(skSelectToolWindowFrame, &frame);
        }
        new ToolSelectionWindow(frame);
    }

    fSelectionWindow->MoveTo(FitRectToScreen(fSelectionWindow->Frame()).LeftTop());
}
示例#2
0
文件: viewwp.c 项目: mingpen/OpenNT
VOID ViewReset(VOID)
{
    RECT rc;
    RECT rcT;

    GetWindowRect(ghwndView, &rc);

    rcT.left = 0;
    rcT.top = 0;
    rcT.right = PALETTEMARGIN + gViewBackMargin +
            gpImageCur->cx + gViewBackMargin + PALETTEMARGIN;
    rcT.bottom = PALETTEMARGIN + gViewBackMargin +
            gpImageCur->cy + gViewBackMargin + PALETTEMARGIN;
    AdjustWindowRect(&rcT, VIEWSTYLE, FALSE);

    rc.right = rc.left + (rcT.right - rcT.left);
    rc.bottom = rc.top + (rcT.bottom - rcT.top);
    FitRectToScreen(&rc);

    SetWindowPos(ghwndView, NULL, rc.left, rc.top,
            rc.right - rc.left, rc.bottom - rc.top,
            SWP_NOACTIVATE | SWP_NOZORDER);

    /*
     * If the user wants it, show the View window now.
     */
    if (gfShowView)
        ViewShow(TRUE);

    ViewUpdate();

    /*
     * Clear out the propbar size and position fields, because they
     * probably show the wrong information now.
     */
    PropBarClearPos();
    PropBarClearSize();
}
示例#3
0
文件: util.c 项目: mingpen/OpenNT
VOID CenterWindow(
    HWND hwnd)
{
    RECT rc;
    RECT rcOwner;
    RECT rcCenter;
    HWND hwndOwner;

    GetWindowRect(hwnd, &rc);

    if (!(hwndOwner = GetWindow(hwnd, GW_OWNER)))
        hwndOwner = GetDesktopWindow();

    GetWindowRect(hwndOwner, &rcOwner);

    /*
     *  Calculate the starting x,y for the new
     *  window so that it would be centered.
     */
    rcCenter.left = rcOwner.left +
            (((rcOwner.right - rcOwner.left) -
            (rc.right - rc.left))
            / 2);

    rcCenter.top = rcOwner.top +
            (((rcOwner.bottom - rcOwner.top) -
            (rc.bottom - rc.top))
            / 2);

    rcCenter.right = rcCenter.left + (rc.right - rc.left);
    rcCenter.bottom = rcCenter.top + (rc.bottom - rc.top);

    FitRectToScreen(&rcCenter);

    SetWindowPos(hwnd, NULL, rcCenter.left, rcCenter.top, 0, 0,
            SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
}