Commit 228b9b7b authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

wineconsole: Add registry support for font pitch&family.

parent a507126a
......@@ -38,6 +38,7 @@ static const WCHAR wszCursorVisible[] = {'C','u','r','s','o','r','V','i','s'
static const WCHAR wszEditionMode[] = {'E','d','i','t','i','o','n','M','o','d','e',0};
static const WCHAR wszExitOnDie[] = {'E','x','i','t','O','n','D','i','e',0};
static const WCHAR wszFaceName[] = {'F','a','c','e','N','a','m','e',0};
static const WCHAR wszFontPitchFamily[] = {'F','o','n','t','P','i','t','c','h','F','a','m','i','l','y',0};
static const WCHAR wszFontSize[] = {'F','o','n','t','S','i','z','e',0};
static const WCHAR wszFontWeight[] = {'F','o','n','t','W','e','i','g','h','t',0};
static const WCHAR wszHistoryBufferSize[] = {'H','i','s','t','o','r','y','B','u','f','f','e','r','S','i','z','e',0};
......@@ -56,10 +57,10 @@ static const WCHAR color_name_fmt[] = {'%','s','%','0','2','d',0};
void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg)
{
WINE_TRACE("%s cell=(%u,%u) cursor=(%d,%d) attr=%02x pop-up=%02x font=%s/%u hist=%u/%d flags=%c%c%c "
WINE_TRACE("%s cell=(%u,%u) cursor=(%d,%d) attr=%02x pop-up=%02x font=%s/%u/%u hist=%u/%d flags=%c%c%c "
"msk=%08x sb=(%u,%u) win=(%u,%u)x(%u,%u) edit=%u registry=%s\n",
pfx, cfg->cell_width, cfg->cell_height, cfg->cursor_size, cfg->cursor_visible, cfg->def_attr,
cfg->popup_attr, wine_dbgstr_w(cfg->face_name), cfg->font_weight, cfg->history_size,
cfg->popup_attr, wine_dbgstr_w(cfg->face_name), cfg->font_pitch_family, cfg->font_weight, cfg->history_size,
cfg->history_nodup ? 1 : 2, cfg->insert_mode ? 'I' : 'i', cfg->quick_edit ? 'Q' : 'q',
cfg->exit_on_die ? 'X' : 'x', cfg->menu_mask, cfg->sb_width, cfg->sb_height,
cfg->win_pos.X, cfg->win_pos.Y, cfg->win_width, cfg->win_height, cfg->edition_mode,
......@@ -124,6 +125,10 @@ static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg)
RegQueryValueExW(hConKey, wszFaceName, 0, &type, (LPBYTE)&cfg->face_name, &count);
count = sizeof(val);
if (!RegQueryValueExW(hConKey, wszFontPitchFamily, 0, &type, (LPBYTE)&val, &count))
cfg->font_pitch_family = val;
count = sizeof(val);
if (!RegQueryValueExW(hConKey, wszFontSize, 0, &type, (LPBYTE)&val, &count))
{
int height = HIWORD(val);
......@@ -211,6 +216,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
cfg->cursor_visible = 1;
cfg->exit_on_die = 1;
memset(cfg->face_name, 0, sizeof(cfg->face_name));
cfg->font_pitch_family = FIXED_PITCH | FF_DONTCARE;
cfg->cell_height = MulDiv( 16, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
cfg->cell_width = MulDiv( 8, GetDpiForSystem(), USER_DEFAULT_SCREEN_DPI );
cfg->font_weight = FW_NORMAL;
......@@ -285,6 +291,9 @@ static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg)
RegSetValueExW(hConKey, wszFaceName, 0, REG_SZ, (LPBYTE)&cfg->face_name, sizeof(cfg->face_name));
val = cfg->font_pitch_family;
RegSetValueExW(hConKey, wszFontPitchFamily, 0, REG_DWORD, (LPBYTE)&val, sizeof(val));
width = MulDiv( cfg->cell_width, USER_DEFAULT_SCREEN_DPI, GetDpiForSystem() );
height = MulDiv( cfg->cell_height, USER_DEFAULT_SCREEN_DPI, GetDpiForSystem() );
val = MAKELONG(width, height);
......
......@@ -35,6 +35,7 @@ struct config_data {
DWORD def_attr; /* default fill attributes (screen colors) */
DWORD popup_attr; /* pop-up color attributes */
WCHAR face_name[32]; /* name of font (size is LF_FACESIZE) */
DWORD font_pitch_family;
DWORD font_weight;
DWORD history_size; /* number of commands in history buffer */
DWORD history_nodup; /* TRUE if commands are not stored twice in buffer */
......
......@@ -445,7 +445,8 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf
data->curcfg.menu_mask = cfg->menu_mask;
data->curcfg.quick_edit = cfg->quick_edit;
if (strcmpiW(data->curcfg.face_name, cfg->face_name) || data->curcfg.cell_width != cfg->cell_width ||
data->curcfg.cell_height != cfg->cell_height || data->curcfg.font_weight != cfg->font_weight)
data->curcfg.cell_height != cfg->cell_height || data->curcfg.font_pitch_family != cfg->font_pitch_family ||
data->curcfg.font_weight != cfg->font_weight)
{
RECT r;
data->fnSetFont(data, cfg->face_name, cfg->cell_height, cfg->font_weight);
......@@ -459,7 +460,7 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf
req->font_width = cfg->cell_width;
req->font_height = cfg->cell_height;
req->font_weight = cfg->font_weight;
req->font_pitch_family = FIXED_PITCH | FF_DONTCARE;
req->font_pitch_family = cfg->font_pitch_family;
wine_server_add_data( req, cfg->face_name, lstrlenW(cfg->face_name) * sizeof(WCHAR) );
wine_server_call( req );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment