Commit b1e6d4c1 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

wineconsole: Replace hard-coded WCUSER_ColorMap with registry color_map.

parent 1602eff3
...@@ -147,6 +147,14 @@ static INT_PTR WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, L ...@@ -147,6 +147,14 @@ static INT_PTR WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, L
return TRUE; return TRUE;
} }
static COLORREF get_color(struct dialog_info *di, unsigned int idc)
{
LONG_PTR index;
index = GetWindowLongPtrW(GetDlgItem(di->hDlg, idc), 0);
return di->config.color_map[index];
}
/****************************************************************** /******************************************************************
* WCUSER_FontPreviewProc * WCUSER_FontPreviewProc
* *
...@@ -196,10 +204,10 @@ static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -196,10 +204,10 @@ static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam,
int len; int len;
hOldFont = SelectObject(ps.hdc, hFont); hOldFont = SelectObject(ps.hdc, hFont);
bkcolor = WCUSER_ColorMap[GetWindowLongW(GetDlgItem(di->hDlg, IDC_FNT_COLOR_BK), 0)]; bkcolor = get_color(di, IDC_FNT_COLOR_BK);
FillRect(ps.hdc, &ps.rcPaint, CreateSolidBrush(bkcolor)); FillRect(ps.hdc, &ps.rcPaint, CreateSolidBrush(bkcolor));
SetBkColor(ps.hdc, bkcolor); SetBkColor(ps.hdc, bkcolor);
SetTextColor(ps.hdc, WCUSER_ColorMap[GetWindowLongW(GetDlgItem(di->hDlg, IDC_FNT_COLOR_FG), 0)]); SetTextColor(ps.hdc, get_color(di, IDC_FNT_COLOR_FG));
len = LoadStringW(GetModuleHandleW(NULL), IDS_FNT_PREVIEW, len = LoadStringW(GetModuleHandleW(NULL), IDS_FNT_PREVIEW,
buf, sizeof(buf) / sizeof(buf[0])); buf, sizeof(buf) / sizeof(buf[0]));
if (len) if (len)
...@@ -231,19 +239,22 @@ static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam ...@@ -231,19 +239,22 @@ static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam
PAINTSTRUCT ps; PAINTSTRUCT ps;
int i, step; int i, step;
RECT client, r; RECT client, r;
struct dialog_info *di;
HBRUSH hbr; HBRUSH hbr;
BeginPaint(hWnd, &ps); BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &client); GetClientRect(hWnd, &client);
step = client.right / 8; step = client.right / 8;
di = (struct dialog_info *)GetWindowLongPtrW(GetParent(hWnd), DWLP_USER);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
r.top = (i / 8) * (client.bottom / 2); r.top = (i / 8) * (client.bottom / 2);
r.bottom = r.top + client.bottom / 2; r.bottom = r.top + client.bottom / 2;
r.left = (i & 7) * step; r.left = (i & 7) * step;
r.right = r.left + step; r.right = r.left + step;
hbr = CreateSolidBrush(WCUSER_ColorMap[i]); hbr = CreateSolidBrush(di->config.color_map[i]);
FillRect(ps.hdc, &r, hbr); FillRect(ps.hdc, &r, hbr);
DeleteObject(hbr); DeleteObject(hbr);
if (GetWindowLongW(hWnd, 0) == i) if (GetWindowLongW(hWnd, 0) == i)
......
...@@ -30,15 +30,6 @@ WINE_DECLARE_DEBUG_CHANNEL(wc_font); ...@@ -30,15 +30,6 @@ WINE_DECLARE_DEBUG_CHANNEL(wc_font);
UINT g_uiDefaultCharset; UINT g_uiDefaultCharset;
/* mapping console colors to RGB values */
const COLORREF WCUSER_ColorMap[16] =
{
RGB(0x00, 0x00, 0x00), RGB(0x00, 0x00, 0x80), RGB(0x00, 0x80, 0x00), RGB(0x00, 0x80, 0x80),
RGB(0x80, 0x00, 0x00), RGB(0x80, 0x00, 0x80), RGB(0x80, 0x80, 0x00), RGB(0xC0, 0xC0, 0xC0),
RGB(0x80, 0x80, 0x80), RGB(0x00, 0x00, 0xFF), RGB(0x00, 0xFF, 0x00), RGB(0x00, 0xFF, 0xFF),
RGB(0xFF, 0x00, 0x00), RGB(0xFF, 0x00, 0xFF), RGB(0xFF, 0xFF, 0x00), RGB(0xFF, 0xFF, 0xFF),
};
static BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONTW* font); static BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONTW* font);
/****************************************************************** /******************************************************************
...@@ -76,8 +67,8 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_ ...@@ -76,8 +67,8 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
for (i = 0; i < data->curcfg.sb_width; i++) for (i = 0; i < data->curcfg.sb_width; i++)
{ {
attr = cell[i].Attributes; attr = cell[i].Attributes;
SetBkColor(PRIVATE(data)->hMemDC, WCUSER_ColorMap[(attr>>4)&0x0F]); SetBkColor(PRIVATE(data)->hMemDC, data->curcfg.color_map[(attr >> 4) & 0x0F]);
SetTextColor(PRIVATE(data)->hMemDC, WCUSER_ColorMap[attr&0x0F]); SetTextColor(PRIVATE(data)->hMemDC, data->curcfg.color_map[attr & 0x0F]);
for (k = i; k < data->curcfg.sb_width && cell[k].Attributes == attr; k++) for (k = i; k < data->curcfg.sb_width && cell[k].Attributes == attr; k++)
{ {
line[k - i] = cell[k].Char.UnicodeChar; line[k - i] = cell[k].Char.UnicodeChar;
...@@ -86,7 +77,7 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_ ...@@ -86,7 +77,7 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
ExtTextOutW( PRIVATE(data)->hMemDC, i * data->curcfg.cell_width, j * data->curcfg.cell_height, ExtTextOutW( PRIVATE(data)->hMemDC, i * data->curcfg.cell_width, j * data->curcfg.cell_height,
0, NULL, line, k - i, dx ); 0, NULL, line, k - i, dx );
if (PRIVATE(data)->ext_leading && if (PRIVATE(data)->ext_leading &&
(hbr = CreateSolidBrush(WCUSER_ColorMap[(attr>>4)&0x0F]))) (hbr = CreateSolidBrush(data->curcfg.color_map[(attr >> 4) & 0x0F])))
{ {
r.left = i * data->curcfg.cell_width; r.left = i * data->curcfg.cell_width;
r.top = (j + 1) * data->curcfg.cell_height - PRIVATE(data)->ext_leading; r.top = (j + 1) * data->curcfg.cell_height - PRIVATE(data)->ext_leading;
......
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