Пример #1
0
/******************************************************************
 *		select_font
 *
 *
 */
static BOOL  select_font(struct dialog_info* di)
{
    int		font_idx, size_idx;
    WCHAR	buf[256];
    WCHAR	fmt[128];
    LOGFONT     lf;
    HFONT       hFont, hOldFont;
    struct config_data config;

    font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
    size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);

    if (font_idx < 0 || size_idx < 0 || size_idx >= di->nFont)
        return FALSE;

    WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
                       di->font[size_idx].height, di->font[size_idx].weight);
    hFont = WCUSER_CopyFont(&config, di->data->hWnd, &lf, NULL);
    if (!hFont) return FALSE;

    if (config.cell_height != di->font[size_idx].height)
        WINE_TRACE("mismatched heights (%u<>%u)\n",
                   config.cell_height, di->font[size_idx].height);
    hOldFont = (HFONT)SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0L, 0L);

    SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (WPARAM)hFont, TRUE);
    if (hOldFont) DeleteObject(hOldFont);

    LoadString(GetModuleHandle(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(WCHAR));
    wsprintf(buf, fmt, config.cell_width, config.cell_height);

    SendDlgItemMessage(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);

    return TRUE;
}
Пример #2
0
/******************************************************************
 *		WCUSER_ApplyDefault
 *
 *
 */
static void WCUSER_ApplyDefault(struct dialog_info* di, HWND hDlg, enum WCUSER_ApplyTo apply, DWORD val)
{
    switch (apply)
    {
    case WCUSER_ApplyToCursorSize:
    case WCUSER_ApplyToHistorySize:
    case WCUSER_ApplyToHistoryMode:
    case WCUSER_ApplyToBufferSize:
    case WCUSER_ApplyToWindow:
        /* not saving those for now... */
        break;
    case WCUSER_ApplyToMenuMask:
        di->config->menu_mask = val;
        break;
    case WCUSER_ApplyToEditMode:
        di->config->quick_edit = val;
        break;
    case WCUSER_ApplyToFont:
        {
            LOGFONT     lf;
            HFONT       hFont;

            WCUSER_FillLogFont(&lf, di->font[val].faceName,
                               di->font[val].height, di->font[val].weight);
            hFont = WCUSER_CopyFont(di->config, PRIVATE(di->data)->hWnd, &lf);
            DeleteObject(hFont);
        }
        break;
    case WCUSER_ApplyToAttribute:
        di->config->def_attr = val;
        break;
    }
    WINECON_RegSave(di->config);
}
Пример #3
0
/******************************************************************
 *		WCUSER_ApplyCurrent
 *
 *
 */
static void WCUSER_ApplyCurrent(struct dialog_info* di, HWND hDlg, enum WCUSER_ApplyTo apply, DWORD val)
{
    switch (apply)
    {
    case WCUSER_ApplyToCursorSize:
        {
            CONSOLE_CURSOR_INFO cinfo;
            cinfo.dwSize = val;
            cinfo.bVisible = di->config->cursor_visible;
            /* this shall update (through notif) curcfg */
            SetConsoleCursorInfo(di->data->hConOut, &cinfo);
        }
        break;
    case WCUSER_ApplyToHistorySize:
        di->config->history_size = val;
        WINECON_SetHistorySize(di->data->hConIn, val);
        break;
    case WCUSER_ApplyToHistoryMode:
        WINECON_SetHistoryMode(di->data->hConIn, val);
        break;
    case WCUSER_ApplyToMenuMask:
        di->config->menu_mask = val;
        break;
    case WCUSER_ApplyToEditMode:
        di->config->quick_edit = val;
        break;
    case WCUSER_ApplyToFont:
        {
            LOGFONT lf;
            WCUSER_FillLogFont(&lf, di->font[val].faceName,
                               di->font[val].height, di->font[val].weight);
            WCUSER_SetFont(di->data, &lf);
        }
        break;
    case WCUSER_ApplyToAttribute:
        di->config->def_attr = val;
        SetConsoleTextAttribute(di->data->hConOut, val);
        break;
    case WCUSER_ApplyToBufferSize:
        /* this shall update (through notif) curcfg */
        SetConsoleScreenBufferSize(di->data->hConOut, *(COORD*)val);
        break;
    case WCUSER_ApplyToWindow:
        /* this shall update (through notif) curcfg */
        SetConsoleWindowInfo(di->data->hConOut, FALSE, (SMALL_RECT*)val);
        break;
    }
}
Пример #4
0
/******************************************************************
 *		WCUSER_FontDlgProc
 *
 * Dialog proc for the Font property sheet
 */
static INT_PTR WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    struct dialog_info*		di;

    switch (msg)
    {
    case WM_INITDIALOG:
        di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
        di->hDlg = hDlg;
        SetWindowLongPtr(hDlg, DWLP_USER, (DWORD_PTR)di);
        /* remove dialog from this control, font will be reset when listboxes are filled */
        SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L);
        fill_list_font(di);
        SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F);
        SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
        break;
    case WM_COMMAND:
        di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
        switch (LOWORD(wParam))
        {
        case IDC_FNT_LIST_FONT:
            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                fill_list_size(di, FALSE);
            }
            break;
        case IDC_FNT_LIST_SIZE:
            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                select_font(di);
            }
            break;
        }
        break;
    case WM_NOTIFY:
    {
        NMHDR*	nmhdr = (NMHDR*)lParam;
        DWORD   val;

        di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
        switch (nmhdr->code)
        {
        case PSN_SETACTIVE:
            di->hDlg = hDlg;
            break;
        case PSN_APPLY:
            val = SendDlgItemMessage(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);

            if (val < di->nFont)
            {
                LOGFONT lf;

                WCUSER_FillLogFont(&lf, di->font[val].faceName,
                                   di->font[val].height, di->font[val].weight);
                DeleteObject(WCUSER_CopyFont(&di->config,
                                             di->data->hWnd, &lf, NULL));
            }

            val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
                  GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0);
            di->config.def_attr = val;

            SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
            return TRUE;
        default:
            return FALSE;
        }
        break;
    }
    default:
        return FALSE;
    }
    return TRUE;
}